ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1209. 1, 10, 100, 1000...

No subject
Posted by Roman Furko 28 Nov 2010 23:24
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