Cod sursa(job #2368625)
Utilizator | Data | 5 martie 2019 16:48:07 | |
---|---|---|---|
Problema | Fractii | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.23 kb |
#include <fstream>
int s[1000001],n,i,j;unsigned long long r;std::ifstream f("fractii.in");std::ofstream g("fractii.out");int main(){f>>n;for(i=2;i<=n;i++)s[i]=i-1;for(i=2;i<=n;i++){r+=s[i];for(j=i+i;j<=n;j=j+i)s[j]-=s[i];}r*=2;g<<r+1;}