Cod sursa(job #1327864)
Utilizator | Data | 27 ianuarie 2015 12:07:44 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
#include <cstdio>
using namespace std;
ofstream g("fractii.out");
int N, i, j, a, b, R;
long long k;
int main()
{
freopen ("fractii.in", "r", stdin);
scanf("%d", &N);
k=4*N-5;
for(i=2; i<=N; i++)
for(j=i+2; j<=N; j++)
{
a=i;
b=j;
R=a%b;
while(R!=0)
{
a=b;
b=R;
R=a%b;
}
if(b==1) k+=2;
g<<k;
return 0;
}