Cod sursa(job #937366)
| Utilizator | Data | 10 aprilie 2013 09:44:35 | |
|---|---|---|---|
| Problema | Fractii | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int main()
{
int tot[100005], n;
long long rez = 0;
fin >> n;
for(int i=2; i<=n; i++)
tot[i] = i;
for(int i=2; i<=n; i++){
if(tot[i] == i)
for(int j=i; j<=n; j += i)
tot[j] = tot[j]/i*(i-1);
rez += tot[i];
}
fout<<(rez*2)+1;
}
