Mixtures(harry potter) - spoj

Question link:https://www.spoj.com/submit/MIXTURES/
Answer link: https://ide.codingblocks.com/s/49822

I have done through bottom up approach. It is giving wrong answer on submission.

Hey @Vidushi04
Your logic is correct but your code runs only for a single test case. But as given in example on Spoj there may be many test cases one after another.
So you need to use a loop like
while (in.hasNext()) { … }
to handle that

I’m sharing code with you. You can take help from it.
https://ide.codingblocks.com/s/50024

Take a look and learn how to take continuous input and print output as it may be required in many such questions. :slightly_smiling_face:

thank you sir :
:slightly_smiling_face: