Cod sursa(job #615066)
Utilizator | Data | 8 octombrie 2011 15:06:06 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream.h>
using namespace std;
int main()
{
int n,x,y,i,j,k=0;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
fin>>n;
fin.close();
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
x=i;
y=j;
while(x!=y)
if(x>y)
x=x-y;
else
y=y-x;
if(x==1)
k++;
}
fout<<k;
fout.close();
return 0;
}