Cod sursa(job #1043741)
Utilizator | Data | 28 noiembrie 2013 21:56:59 | |
---|---|---|---|
Problema | Dreptunghiuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<cstdio>
#include<cmath>
using namespace std;
int N,M,A,B,C,D;
long long ras;
int main()
{
freopen("dreptunghiuri.in","r",stdin);
freopen("dreptunghiuri.out","w",stdout);
scanf("%d%d",&N,&M);
ras=1LL*N*(N-1)/2*M*(M-1)/2;
for(A=1;A<N;A++)
for(B=1;B+A+1<=N;B++)
for(C=1;C<M;C++)
if((A*B)%C==0)
{
D=(A*B)/C;
ras+=1LL*(N-A-B)*(M-C-D);
}
printf("%lld\n",ras);
return 0;
}