Cod sursa(job #2595295)

Utilizator alex_benescuAlex Ben alex_benescu Data 7 aprilie 2020 15:20:36
Problema Dreptunghiuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.29 kb
#import<bits/stdc++.h>
using namespace std;ifstream f("dreptunghiuri.in");ofstream g("dreptunghiuri.out");long long s,i,j,x,y,a,b,A,B;main(){f>>x>>y;for(i=1;i<=x;++i)for(j=0;j<=y;++j)if(__gcd(i,j)==1)for(a=1;a*i<=x;++a)for(b=1,A=a*i+j,B=a*j+i;A<=x&&B<=y;++b,A+=j,B+=i)s+=(x-A)*(y-B);g<<s;}