Cod sursa(job #1015342)
| Utilizator | Data | 24 octombrie 2013 14:12:46 | |
|---|---|---|---|
| Problema | Fractii | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
int n,
v[1000001];
long long ct = 0;
int main () {
ifstream f("fractii.in");
ofstream g("fractii.out");
f>> 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++)
ct += v[i];
g << 2 * ct + 1;
return 0;
}
