Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Johnny and the Beanstalk problem

$
0
0

First, of all description of this question is too bad. But, i managed to solve it.

But, i have a doubt in this problem when the previous count or sum is less than the current input of the user then i break the loop and print No as a answer. But, what about the rest of the input how they can be handled. They can become the input for the next test case.

I solve it both ways by breaking the loop immediately, and by reading the whole input stream. Both, works fine on online judge.

You can check both the solutions here and here.

1st one is faster takes 0.20sec and 2nd one takes 0.36sec


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>