Time Exceeded
Code
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int t;cin>>t;
while(t--){
long long n;cin>>n;
long long ans=0;
long long d=1;
while(d<n){
long long v=n/d;
long long l=d;
long long r=n/(v);
if(r>=n)r=n-1;
ans+=(r-l+1)*(v-1);
d=r+1;
}
cout<<ans<<'\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-15 01:45:43
- Judged At
- 2025-07-15 01:45:43
- Judged By
- Score
- 5
- Total Time
- ≥1000ms
- Peak Memory
- ≥580.0 KiB