http://www.spoj.com/problems/PANCAKES/
This is a very good implementation task where the implementation is not very hard but we need to be extra careful while doing it. First of all there is a case where the needed ingredients are more than the ones we have, in that case the answer is 1 0 which means by taking the first recipe we weren't able to cook any pancakes. Then , for doing the calculations I recommend avoiding floats do it with integers, Initially while reading the input data increase the given ingredients which have have 10 times so that when it comes to dividing the ingredients on one another for finding the number of pancakes the problem with that 10 will be solved. Also check the source code for a better understanding.
This is a very good implementation task where the implementation is not very hard but we need to be extra careful while doing it. First of all there is a case where the needed ingredients are more than the ones we have, in that case the answer is 1 0 which means by taking the first recipe we weren't able to cook any pancakes. Then , for doing the calculations I recommend avoiding floats do it with integers, Initially while reading the input data increase the given ingredients which have have 10 times so that when it comes to dividing the ingredients on one another for finding the number of pancakes the problem with that 10 will be solved. Also check the source code for a better understanding.
No comments:
Post a Comment