spoj BYECAKES

Getting WA repeatedly. Can’t find the error in my logic. Can anyone Help??

check for input 0 0 0 0
its a tricky case of this question ,i guess… answer should be 0 right? as he’s not wasting anything…

1 Like

Have you tried using C++?

No, I dont’t think language is a problem here. The only difference between my code and the accepted ones seems to be in the ratio line http://qr.ae/mK44O. But still I dont find anything wrong in my logic of taking ratios

I can’t find anything wrong with your logic. Someone must answer this question. But I would like to point out one thing:

 b[0]+=max-b[0]; 

does nothing but assigning max to b[0]. Same for b[1],b[2],b[3].

Yeah I knew that before…but still can’t find anything wrong

http://www.spojtoolkit.com/Testing.php?q=BYECAKES

can anyone help tried many test cases

KSxKGq - Online Java Compiler & Debugging Tool - Ideone.com http://www.spojtoolkit.com/Testing.php?q=BYECAKES

can anyone help tried many test cases

lol…thanks mate such a bad mistake on my part of not checking the boundary cases. :slight_smile:

anytime :slight_smile:

but one thing… after adding this tricky case i still didn’t got a AC :stuck_out_tongue:

You can use this Solution for reference.
And can you also look into
http://discuss.codechef.com/questions/59132/spoj-brckts-runtime-error-nzec