Cod sursa(job #2722102)
| Utilizator | Data | 12 martie 2021 16:26:43 | |
|---|---|---|---|
| Problema | Fractii | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream>
using namespace std;
ifstream cin("fractii.in");
ofstream cout("fractii.out");
long long rez;
int cnt[1000000];
int main(){
int n;
cin >> n;
for(int i = 2; i <= n; i++){
cnt[i] = i - 1 - cnt[i];
for(int j = 2; j*i <= n; j++)
cnt[i*j] = cnt[i] + cnt[i*j];
}
for(int i = 2; i <= n; i++)
rez = rez + (long long)cnt[i] * 2;
rez++;
cout << rez;
return 0;
}