Time Exceeded
Code
#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 S = 0;
for (ll i = 1, j; i <= N; i = j + 1) {
ll q = N / i;
j = N / q;
S += q * (j - i + 1);
}
cout << (S - N) << "\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 15:50:08
- Judged At
- 2025-07-14 15:50:08
- Judged By
- Score
- 5
- Total Time
- ≥1099ms
- Peak Memory
- ≥568.0 KiB