Pagini recente » Cod sursa (job #3281938) | Cod sursa (job #2276934) | Cod sursa (job #2799814) | Cod sursa (job #760052) | Cod sursa (job #193437)
Cod sursa(job #193437)
#include"stdio.h"
#include"stdint.h"
#include <cstdlib>
long x;
long out;
struct nod
{
int n;nod *next;
};nod *a,*b,*c;
int cmmdc(int_fast32_t x,const int_fast32_t y)
{
if(y){x%=y;return cmmdc(y,x);}
else return x;
}
int val(const int_fast32_t x,const int_fast32_t y)
{
if(!x||!y)return 0;
if(cmmdc(x,y)==1){return 1;}
return 0;
}
int main()
{
freopen("fractii.out","w",stdout);
//freopen("fractii.in","r",stdin);
scanf("%ld",&x);
for(int_fast32_t g=0;g<(x+1)*(x+1)-1;g++){out+=val(g%(x+1),(g+1)/(x+1));}
printf("%ld",out);
return 0;
}