Cod sursa(job #294378)
Utilizator | Data | 2 aprilie 2009 14:55:51 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include<fstream.h>
#include<math.h>
int main()
{
long n,catid=1,o=1;
ifstream In("fractii.in");
ofstream Out("fractii.out");
In>>n;
for(long k=2;k<=n;k++)
{
for(int g=2;g<=sqrt(k);g++)
{
if(k%g==0||(k%(k%g)==0)){catid++;}
}
o=o+((k-catid)*2);catid=1;
}
if(n%10==0){o=o-n;}
Out<<o;
Out.close();In.close();
return 0;
}