Time Exceeded
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll M = 998244353, inv2 = (M + 1) / 2;
signed main() {
ll t = 1;
cin >> t;
while (t--) {
ll n;
cin >> n;
ll sum = 0;
for (ll left = 1, right; left <= n; left = right + 1) {
ll k = n / left;
right = n / k;
ll count = (right - left + 1);
sum = sum + (count * k);
}
cout << sum - 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-07-31 06:27:10
- Judged At
- 2025-07-31 06:27:10
- Judged By
- Score
- 5
- Total Time
- ≥1099ms
- Peak Memory
- ≥544.0 KiB