Cod sursa(job #1874920)
| Utilizator | Data | 10 februarie 2017 16:06:15 | |
|---|---|---|---|
| Problema | Fractii | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
#include <bitset>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int n;
long long raspuns=1;
int solutie[1000001];
int main()
{
in>>n;
for (int i = 2; i<=n; i++)
{
solutie[i]=i-1;
}
for (int i = 2; i <= n; i++)
{
for (int j = 2; j<=n/i; j++)
{
solutie[i*j]-=solutie[i];
}
raspuns+=2*solutie[i];
}
out<<raspuns;
return 0;
}
