Cod sursa(job #615068)

Utilizator DarkdayalexSecara Ion Alexandru Darkdayalex Data 8 octombrie 2011 15:07:27
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include<fstream>
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;
}