在某些情况下有误差
public static int Sqrt(int a)
{
switch (a)
{
case 0:
return 0;
case 1:
case 2:
case 3:
return 1;
default:
int n = a / 2;
int m = (n + a / n) / 2;
while (n > m)
{
n = m;
m = (n + a / n) / 2;
}
return m;
}
}