Pagini recente » Cod sursa (job #1311167) | Cod sursa (job #1164667) | Istoria paginii runda/oni10/clasament | Cod sursa (job #958135) | Cod sursa (job #1458533)
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("fractii.in");
ofstream o("fractii.out");
int ireductibil(int i,int j)
{
int a,b,x,y;
a=i;b=j;
x=a;y=b;
while(x!=y)
if(x>y)
x=x-y;
else
y=y-x;
if(x==1)
return 1;
return 0;
}
int main()
{int n,k=0,i=1,j=1;
f>>n;
for(;i<=n;i++)
for(;j<=n;j++)
{if(ireductibil(i,j)==1)
k++;
}
cout<<k;
}