Cod sursa(job #294368)
Utilizator | Data | 2 aprilie 2009 14:48:58 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 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&&k%g!=1)){catid++;}
}
o=o+((k-catid)*2);catid=1;
}
Out<<o;
Out.close();In.close();
return 0;
}