Cod sursa(job #1594085)
Utilizator | Data | 9 februarie 2016 10:35:19 | |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
int i,j,k,aux,y,x,ok=0;
ifstream fin("fractii.in");
fin>>n;
fin.close();
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
k=1;
x=i;y=j;
while(k==1)
if(!y) k=0;
else
{
aux=x;
x=y;
y=aux%y;
}
if(x<=1) {ok++;}
}
ofstream fout("fractii.out");
fout<<ok;
fout.close();
return 0;
}