Time Exceeded
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
ll n, c = 0;
cin >> n;
for (ll x = 1; x <= n; x++) {
for (ll a = 1; a * a <= x; a++) {
if (x % a == 0) {
ll b = x / a;
if (abs(a - b) <= 1) {
c++;
break;
}
}
}
}
cout << c << "\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1191 A. Balanced Product
- Contest
- Brain Booster #10
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 17:40:52
- Judged At
- 2025-06-13 17:40:52
- Judged By
- Score
- 40
- Total Time
- ≥1100ms
- Peak Memory
- ≥540.0 KiB