Time Exceeded
Code
#pragma GCC optimize("O3", "inline")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define ub upper_bound
#define INF 1e18 + 100
ll solve()
{
int n;
cin >> n;
ll ans = 0;
for(int i = 1; i <= n; i++){
ll add = max(n / i - 1, 0);
ans += add;
}
return ans;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while(t--)
{
ll x = solve();
cout << x << "\n";
}
return 0;
}
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-15 05:22:25
- Judged At
- 2025-07-15 05:22:25
- Judged By
- Score
- 0
- Total Time
- ≥1100ms
- Peak Memory
- ≥568.0 KiB