Cod sursa(job #1524316)
| Utilizator | Data | 13 noiembrie 2015 21:26:56 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
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;
return 0;
}
