Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n;cin>>n;
ll k = 1;
ll ans = 1;
bool f = false;
for ( ; k*k <= n ; k++) {
// cout<<k<<" ";
if (k*(k+1) <= n || k*k <= n) {
ans = k;
if (k*(k+1) <= n) f = true;
else f = false;
}
}
if (!f) {
cout<<2*(ans-1)+1;
} else {
cout<<2*ans;
}
cout<<endl;
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 15:52:22
- Judged At
- 2025-06-13 15:52:22
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB