Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
bool perfectsqr(int n) {
int root = sqrt(n);
return root * root == n;
}
int nearestsqr(int n){
int ans = (int)(floor(sqrt(n)));
return ans;
}
int main(){
int n; cin>>n;
int ans = nearestsqr(n);
if(perfectsqr(n)){
cout<< 2 * ans - 1<<endl;
}
else {
cout<< 2*ans <<endl;
}
}
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 16:34:13
- Judged At
- 2025-06-13 16:34:13
- Judged By
- Score
- 40
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB