Time Exceeded
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long ans = 0;
long long d = 1;
while (d <= n) {
long long v = n / d;
long long r = n / v;
if (v > 1) {
ans += (r - d + 1) * (v - 1);
}
d = r + 1;
}
cout << ans << '\n';
}
return 0;
}
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:13:18
- Judged At
- 2025-07-14 17:13:18
- Judged By
- Score
- 5
- Total Time
- ≥1100ms
- Peak Memory
- ≥764.0 KiB