Cod sursa(job #49927)
Utilizator | Data | 6 aprilie 2007 16:34:25 | |
---|---|---|---|
Problema | Dreptunghiuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
# include <stdio.h>
int main()
{
long long int n,m,lat,sol;
FILE *f=fopen("dreptungiuri.in","r");
fscanf(f,"%lld%lld",&n,&m);
sol=n*(n-1)*m*(m-1)/4;
if (n>m) {lat=m;m=n;n=lat;}
for (lat=3;lat<=n;lat++)
sol+=(n-lat+1)*(m-lat+1)*(lat-2);
FILE *g=fopen("dreptungiuri.out","w");
fprintf(g,"%lld\n",sol);
fcloseall();
return 0;
}