Cod sursa(job #2440538)
Utilizator | Data | 18 iulie 2019 17:12:19 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
bool eReductibila(int a, int b) {
int c;
while (b) {
c = a % b;
a = b;
b = c;
}
if (a == 1)
return false;
return true;
}
int main() {
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int n;
fin >> n;
int rez = 0;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
if (!eReductibila(i, j))
++rez;
fout << rez;
return 0;
}