/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 3ms 568.0 KiB
#3 Time Exceeded ≥1099ms ≥560.0 KiB
#4 Time Exceeded ≥1000ms ≥556.0 KiB

Code

/*
 *   Copyright (c) 2025 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int t; cin >> t; while(t--)
    {   
        ll n; cin >> n;
        ll ans = 0;
        ll x=1,next,d;
        while(x<=n)
        {
            d = n/x;
            next = (n/d) + 1;
            ans += (next-x)*d;
            x = next;
        }
        cout<<ans-n<<'\n';
    }
}

Information

Submit By
Type
Submission
Problem
P1207 D2. GCD equal Absolute Value (Hard Version)
Language
C++17 (G++ 13.2.0)
Submit At
2025-06-30 20:21:39
Judged At
2025-06-30 20:21:39
Judged By
Score
5
Total Time
≥1099ms
Peak Memory
≥568.0 KiB