Cod sursa(job #1922371)
Utilizator | Data | 10 martie 2017 17:11:37 | |
---|---|---|---|
Problema | Fractii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int x[1000001];
int main()
{
int n,i,j;
long long nr=1;
fin>>n;
for(i=1;i<=n;i++)
{
x[i]=i-1;
}
for(i=2;i<=n;i++)
{
for(j=2*i;j<=n;j+=i)
{
x[j]=x[j]-x[i];
}
}
for(i=1;i<=n;i++)
{
nr=nr+2*x[i];
}
fout<<nr;
return 0;
}