Accepted
Code
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
cin.tie(0) -> sync_with_stdio(0);
const int N = 1e6 + 1;
int64_t ans[N] {};
for (int i = 1; i < N; i++) {
for (int j = i * 2; j < N; j += i) {
ans[j] += 1;
}
ans[i] += ans[i - 1];
}
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cout << ans[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 17:24:51
- Judged At
- 2025-07-14 17:24:51
- Judged By
- Score
- 100
- Total Time
- 91ms
- Peak Memory
- 8.941 MiB