Cod sursa(job #2722099)
Utilizator | Data | 12 martie 2021 16:25:14 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
using namespace std;
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;
}