Pagini recente » Cod sursa (job #900903) | Cod sursa (job #3191527) | Cod sursa (job #2940392) | Cod sursa (job #1315681) | Cod sursa (job #2405190)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int n, sol;
bool f(int, int);
int main()
{
cin >> n;
for (int i = 1; i <= n; ++i)
{
for (int j = i; j <= n; ++j)
{
if (i != j)
sol += 2 * f(i, j);
else
sol += f(i, j);
}
}
cout << sol;
system("pause");
}
bool f(int x, int y)
{
if (y == 0)
return (x == 1);
else
return f(y, x%y);
}