|
|
back to boardWOW! How did all of you solve this problem so that it doesn't go out of the time limit? Re: WOW! How did all of you solve this problem so that it doesn't go out of the time limit? I have a nice solution. I guess I am not allowed to put it here (if I am, tell me please). If you want it, e-mail me at LalescuLiviu@xnet.ro Re: WOW! How did all of you solve this problem so that it doesn't go out of the time limit? Well, you can post your solution, I won't delete your message, But I will be angry about it :) I think you'd better share your ideas, and not sources. Re: WOW! How did all of you solve this problem so that it doesn't go out of the time limit? > I have a nice solution. I guess I am not allowed to put it > here (if I am, tell me please). If you want it, e-mail me > at LalescuLiviu@xnet.ro please show your idea Re: WOW! How did all of you solve this problem so that it doesn't go out of the time limit? Posted by erik 6 Aug 2003 18:26 I have a function gen(n) which generates the n:th integer, which written in base b has exactly k ones and the rest zeros. Then, using that function, I do a binary search to find the least a such that gen(a)>=x and the least b such that gen(b)>=y+1. The answer is then b-a. |
|
|