Cod sursa(job #49986)
Utilizator | Data | 6 aprilie 2007 18:20:45 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<stdio.h>
int c,n,d,s,i;
FILE *f=fopen("fractii.in","r"),*g=fopen("fractii.out","w");
int main()
{
fscanf(f,"%d",&n);
for(i=1; i<=n; i++)
{c=0;
for(d=2; d<=i; d++)
if(i%d==0)c++;
s=s+c;
}
if(n==2) fprintf(g,"%d",3);
else if(n%2==0)
fprintf(g,"%d",n*n-n-s);
else fprintf(g,"%d",n*n-n-s+1);
}