import java.util.*;
public class Solution {
/**
*
* @param x int整型
* @return int整型
*/
public int sqrt (int x) {
// write code here
if (x <= 0){
return 0;
}
int r = x;
while (r > x / r){
r = (r + x / r) / 2;
}
return r;
}
}