|
|
back to boardNo subject I can solve it in O(1)!!! you must solve equation n - we have x - we must find if (x * (x + 1) / 2)+ 1 == n cout << 1 else cout << 0; but if you want you can find x in o(log n) - by binary search or in o(1) if you solve equation!! Good luck in solving this problem=) Sorry for me bad english=( Edited by author 28.11.2010 23:28 |
|
|