Cod sursa(job #163161)

Utilizator LoLFactorPascu Vlad LoLFactor Data 21 martie 2008 15:56:14
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
using namespace std;

int f(long x, long y){
	while(x != y){
		if(x > y) x -= y;
		else y -= x;
	}
	
if(x == 1) return 0;
else return 1;
}

int main(){
	fstream in("fractii.in", ios::in);
	long i, j, n; int rezultat = 0;
	in >> n; n++; in.close();
	for(i= 1; i < n; i++)
		for(j = 1; j < n; j++)
			if(!f(i, j)) rezultat++;
	fstream out("fractii.out", ios::out);
	out << rezultat;
}