Cod sursa(job #193333)
| Utilizator | Data | 3 iunie 2008 17:31:30 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
#include"stdio.h"
long x;
long out;
int cmmdc(int x,int y)
{
if(y)return cmmdc(y,x%y);
else return x;
}
int val(int x,int y)
{
if(cmmdc(x,y)!=1)return 0;
return 1;
}
int main()
{
freopen("fractii.out","w",stdout);
freopen("fractii.in","r",stdin);
scanf("%ld",&x);
for(int g=1;g<=x;g++)for(int h=1;h<=x;h++)out+=val(g,h);
printf("%ld",out);
return 0;
}
