Code
#include<bits/stdc++.h>
using namespace std;
bool sqr (int n)
{
int r = sqrt(n);
return r*r == n;
}
int main()
{
int n;
cin>>n;
int cnts =0, cntn =0;
for(int i=1; i<=n; i++)
{
if(sqr(i))
{
cnts++;
}
}
int sum=0, add=6;
while(sum+add<=n)
{
sum+=add;
cntn++;
add+=2;
}
cout<<cnts+cntn+1<<endl;
}
Information
- Submit By
- Type
- Pretest
- Problem
- P1191 A. Balanced Product
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 16:29:50
- Judged At
- 2025-06-13 16:29:50
- Judged By
- Score
- 10
- Total Time
- 4ms
- Peak Memory
- 324.0 KiB