Accepted
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
long long res = 0;
for (int ptr = 1; ptr * ptr <= n; ptr++)
{
res += n / ptr;
res += 1LL * ptr * (n / ptr - n / (ptr + 1) - (n / ptr == ptr));
}
cout << res - n << "\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1206 D1. GCD equal Absolute Value (Easy Version)
- Contest
- Educational Round 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 16:44:45
- Judged At
- 2025-07-14 16:44:45
- Judged By
- Score
- 100
- Total Time
- 634ms
- Peak Memory
- 1.414 MiB