CIELRCPT;getting wrong answer PLEASE HELP

Can anyone help, it work very well on even boundry condition, cant figure out defect http://www.codechef.com/viewsolution/1191537 please…

It returns 1 for 3000, but 300010 = 1011101110002, so the answer should be 7.

it is returning 7 dude check it out again…

No, it’s not, check here - http://ideone.com/S1qyJ

well i dont know wats wrong it gives 7 while compiling on dev c++ compiler… can u tell why it may be happening

well i checked it out u choose incorrect language try this it will give correct answer http://ideone.com/teoFg

heh, I always thought that C and C++ is the same language when you are not using STL :-/

well now it still gives wrong answer, is it due to compiler because compiler on ideone for c is 4.3.4 and on codechef its 4.3.0

I will try to find the bug yet…

Are you sure you want to modify b array?

b[a]=b[a]+b[x];

well wat harm is it doing??

It was not nice from you, your link and my link differ in

scanf("%d",&q);

statement :-/

For input

2
3000
4000

your code returns 7 7, but correct answer for 4000 is 6, 400010 = 1111101000002

1 Like

well that statement does not alter the output anyhow :slight_smile:

I have no idea why, but it does, see http://ideone.com/KF6UY

//