February 2016 Posts

Code Chef: ATM question

Hello there friends! This the CodeChef series again.

In CodeChef, the second,  according to number of successful submissions on the beginner practice page, is the ATM problem. This simple question is related to bank transactions where one may withdraw money from an ATM. It was an interesting problem for me for it helps relate programming to real life considering everyone has been to or at least seen an ATM. This question may help a learner understand the logic behind one too though the real thing is far more complicated than the program I wrote below as an answer:

CodeChef beginner practice problem: Life, the Universe, and Everything

If you are here or this has come up in your search for solutions, you probably are having difficulty solving one of the beginner problems on CodeChef.com and hence have decided to google an answer to your frustrating dilemma.

In this blog  I will try to provide an approach to solve the problem but it may not be the sole solution. There are many ways to solve it but I will cover only one method: a beginner’s method. Even though there are many examples you can dig from the pre-submitted answer in the answer page but none carry why, how of the coder thoughts and explanation.

I am only collecting beginner’s approach solutions into a blog so that you may be able to search the answer with an explanation as well.I will mainly focus on programming language Python as at present I am inclined towards it the  most among Python, Java, and C++.