Pagini recente » Monitorul de evaluare | Diferente pentru problema/cia intre reviziile 6 si 7 | Cod sursa (job #1864835) | Cod sursa (job #1943362) | Cod sursa (job #1596169)
#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=i;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*2)-1;
fout.close();
return 0;
}