/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 62ms 8.109 MiB
#2 Accepted 102ms 8.836 MiB
#3 Accepted 78ms 8.816 MiB
#4 Accepted 79ms 8.812 MiB
#5 Accepted 82ms 8.941 MiB

Code

#include <bits/stdc++.h>     //   All praise is due to Allah alone, and peace and blessings be
using namespace std;         //         upon him, after whom there is no other Prophet.

int32_t main() {
    cin.tie(0)->sync_with_stdio(false);

    const int N = 1e6 + 1;

    vector<int64_t> spf(N);
    for(int i = 1; i <= N / 2; i++) {
        for(int j = i + i; j < N; j += i) {
            spf[j]++;
        }
    }
    partial_sum(spf.begin(), spf.end(), spf.begin());

    function<void()> Test_Case = [&]() {
        int n; cin >> n;
        cout << spf[n] << '\n';
    };

    int32_t Case = 1;    cin >> Case;
    for (int T = 1; T <= Case; T++) {
        Test_Case();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1206 D1. GCD equal Absolute Value (Easy Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 17:49:51
Judged At
2025-07-14 17:49:51
Judged By
Score
100
Total Time
102ms
Peak Memory
8.941 MiB