Cod sursa(job #75438)
| Utilizator | Data | 1 august 2007 20:50:38 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<fstream.h>
long int n,r;
int main()
{
long int i,j,x,y;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
fin>>n;
long int cont=2*n-1;
fin.close();
for(i=2;i<=n;i++)
for(j=2;j<=n;j++)
{
if(i!=j)
{
x=i;
y=j;
r=100;
while(r!=0)
{
r=x%y;
x=y;
y=r;
}
if(x==1)
cont++;
}
}
fout<<cont;
fout.close();
return 0;
}
