Cod sursa(job #2615869)
Utilizator | Data | 15 mai 2020 18:45:50 | |
---|---|---|---|
Problema | Fractii | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int main()
{
int N, P, P_copy, total, n; // n e numarul de cautari.
in >> N;
n = 0;
total = ((N-1)*N)/2;
for ( P = 2; P <= N/2; ++P ) {
for ( P_copy = 2; P_copy <= N; P_copy += P_copy )
++n;
++P;
P_copy = P;
}
total = (total - n)*2+1;
out << total;
return 0;
}