Cod sursa(job #613461)

Utilizator DarkdayalexSecara Ion Alexandru Darkdayalex Data 26 septembrie 2011 20:29:09
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<fstream.h>
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;
}