/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 532.0 KiB
#2 Wrong Answer 3ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;

void output(long long x) {
    if (x >= 10)
        output(x / 10);
    putchar(x % 10 + '0');
}

void solve() {
    int n ; cin >> n;
    long long last = 0, val = 0, ans = 0;
    for (int i = 1; i <= n; i = n/val + 1) {
        ans += val*(i - last);
        last = i, val = n/i;
    }
    ans += (n+1) >> 1;
    output(ans - n);
    putchar('\n');
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t; cin >> t;
    auto start = high_resolution_clock ::now();
    while (t--)
        solve();
    cout << duration_cast<milliseconds>(high_resolution_clock::now() - start).count();
}

Information

Submit By
Type
Submission
Problem
P1207 D2. GCD equal Absolute Value (Hard Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 17:59:21
Judged At
2025-07-14 17:59:21
Judged By
Score
0
Total Time
3ms
Peak Memory
532.0 KiB