Cod sursa(job #2229031)
| Utilizator | Data | 5 august 2018 17:56:28 | |
|---|---|---|---|
| Problema | Fractii | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
bool prime(int a, int b)
{
int D=a,I=b,R;
while(I)
{
R=D%I;D=I; I=R;
}
if(D==1)
return 1;
else return 0;
}
int main()
{
int N, count=0;
in>>N;
//pair <int, int> psiq[N];
for(int i=1;i<=N;i++)
for(int j=1;j<=N;j++)
if(prime(i,j)) count++;
out<<count;
out.close();
return 0;
}
