Pagini recente » Cod sursa (job #2922860) | Cod sursa (job #2790221) | Cod sursa (job #1256858) | Cod sursa (job #2330590) | Cod sursa (job #426303)
Cod sursa(job #426303)
//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;
}