Time Exceeded
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