Cod sursa(job #2130848)
| Utilizator | Data | 13 februarie 2018 22:59:35 | |
|---|---|---|---|
| Problema | Fractii | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int v[1000005];
int n;
unsigned long long sol;
int main(){
fin >> n;
for(int i = 1; i <= n; i++)
v[i] = i-1;
for(int i = 2; i <= n; i++)
for(int j = 2*i; j <= n; j += i)
v[j] -= v[i];
for(int i=1;i<=n;i++)
sol += v[i];
sol = 2 * sol + 1;
fout << sol;
return 0;
}
