Thanks for this nice question… B.I.T follow great rule of Mathematics… sum upto 2^n can be formed out of combination of of 1,2,4… n powers of 2.
My solution is working correctly for all the test cases but giving NZEC error on submission…Somebody plz help…the following is the link to my solution…
http://www.codechef.com/viewsolution/5468036
@kevinsogo here is link to my code http://www.codechef.com/viewsolution/6804322.when I am using same logic as yours why am i getting TLE.Is it regarding my input method? Can u also explain at which steps BIT is beating my approach.(why is it fast?).
Faced some issues with input. Maybe this has some ’ ’ before ‘\n’ . Again not sure about this, character-wise input got me AC while token-wise input resulted in NZEC. So a friendly heads-up to others.
Solved using square root decomposition .Worked fine for me:-https://www.codechef.com/viewsolution/17104195