Cod sursa(job #163178)
| Utilizator | Data | 21 martie 2008 16:32:04 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
using namespace std;
int main(){
fstream in("fractii.in", ios::in);
int rezultat = 0; int i, j, n;
in >> n; n++; in.close();
for(i= 1; i < n; i++)
for(j = 1; j < n; j++){
int x = i, y = j;
while(x != y){
if(x > y) x -= y;
else y -= x;
}
if(x == 1) rezultat++;
}
fstream out("fractii.out", ios::out);
out << rezultat;
}
