Time Exceeded
Code
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main() {
// fast io
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T;
cin>>T;
for(int t=1;t<=T;t++) {
ll N;
cin>>N;
ll ans = -N;
for(ll x=1;x<=N;) {
ll curr = N/x;
ll en = min(N,N/curr);
ans += (ll)curr * (en - x + 1);
x = en + 1;
}
cout<<ans<<endl;
}
}
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:23:16
- Judged At
- 2025-07-14 17:23:16
- Judged By
- Score
- 0
- Total Time
- ≥1100ms
- Peak Memory
- ≥760.0 KiB