class Solution {
public:
int mySqrt(int x) {
if(x<4)
{
return x==0?0:1;
}
for(int i = 2; i<=x/2;i++)
{
if(x/i == i || ((i-1)<x/(i-1) && (i+1)>x/(i+1)))
{
return i;
}
}
return 1;
}
};