Cod sursa(job #2628049)

Utilizator Alexandra1Ceobanu Alexandra Alexandra1 Data 14 iunie 2020 10:22:30
Problema Fractii Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
     
    using namespace std;
     
    int main()
    {
        int N, P, P_copy, total, n; // n e numarul de cautari.
        cin >> 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;
        cout << total;
        return 0;
    }