|
|
вернуться в форумi use simple algorhit. it works on my test. Why Wa 6? I test it on random big integers and it work, but i get WA#6 What's wrong? I am sure, My program always gives right answer. #include <stdio.h> class ML // my long integer .... ML sqrt(ML x) { ML l(1); ML r=x; ML m; ML E(1); while (l+E!=r) { m=(l+r)/2; if (m*m>x) r=m; else l=m; } return l; } int main() { ML a; a.read(); sqrt(a*2).write(); return 0; } |
|
|