Cod sursa(job #426303)
Utilizator | Data | 26 martie 2010 18:53:28 | |
---|---|---|---|
Problema | Dreptunghiuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
//infoarena
#include<cstdio>
#include<iostream>
using namespace std;
FILE *f=fopen("dreptunghiuri.in","r");
FILE *g=fopen("dreptunghiuri.out","w");
int n,m,l1,l2;
long s;
int main()
{
fscanf(f,"%d %d",&m,&n);
for(l1=1;l1<n;l1++)
for(l2=1;l2<m;l2++)
{
s+=(n-l1)*(m-l2);//dreptunghiuri+patrate drepte
if(l1+l2<min(m,n)) s+=(n-l1-l2)*(m-l1-l2);//dreptunghiuri oblice
}
fprintf(g,"%ld",s);
return 0;
}