Cod sursa(job #189318)

Utilizator LoLFactorPascu Vlad LoLFactor Data 13 mai 2008 17:11:17
Problema Fractii Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
#include <iostream>
using namespace std;

int main(){
	fstream in("fractii.in", ios::in); int n = 10;
	in >> n; in.close();
	long long rezultat = 1;
	for(int i = 1; i < n; i++)
		for(int j = i + 1; j <= n; j++){
			int x = i, y = j;  
			while(x != y){  
				if(x > y) x -= y;  
				else y -= x;  
			}
            if(x == 1) rezultat += 2;
		}
	fstream out("fractii.out", ios::out);
	out << rezultat;
}