Accepted
Code
#include<bits/stdc++.h>
using namespace std;
#define e4 ios_base::sync_with_stdio(false); cin.tie(NULL)
#define endl '\n'
#define ll long long
#define test_case int tc;cin>>tc;while(tc--)
const ll mx=1e6+5;
int main() {
e4;
vector<ll> mp(mx,0);
for(ll i=1; i<=mx; i++){
for(ll j=i; j<=mx; j+=i){
mp[j]++;
}
}
for(ll i=2; i<=mx; i++){
mp[i]+=mp[i-1];
}
test_case{
ll n;
cin>>n;
cout<<mp[n]-n<<endl;
}
}
// S m o t h e r e d M a t e !! //
Information
- Submit By
- Type
- Submission
- Problem
- P1206 D1. GCD equal Absolute Value (Easy Version)
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-24 10:54:58
- Judged At
- 2025-07-24 10:54:58
- Judged By
- Score
- 100
- Total Time
- 99ms
- Peak Memory
- 8.945 MiB