Cod sursa(job #426296)
Utilizator | Moise Razvan Bunicool | Data | 26 martie 2010 18:42:38 |
---|---|---|---|
Problema | Dreptunghiuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 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))
if(l1!=l2) s+=2*(n-l1-l2)*(m-l1-l2);//dreptunghiuri oblice
else s+=(n-l1-l2)*(m-l1-l2);//patrate oblice
}
fprintf(g,"%ld",s);
return 0;
}