spoj BYECAKES

spoj

#1

https://ideone.com/GdbHQs

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


#2

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…


#3

Have you tried using C++?


#4

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


#5

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].


#6

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


#7


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

can anyone help tried many test cases


#8

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

can anyone help tried many test cases


#9

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


#10

anytime :slight_smile:


#11

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


#12


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