 # ATM problem - What test cases are failing in this case?

In the ATM Problem I submitted this code in Python 2.7

``````def p():
draw, balance = map (float,raw_input().split())

if draw % 5 == 0 and draw <= (balance + 0.5):
balance -= (draw + 0.5)

print "%.2f" %balance

p()
``````

What test cases is this failing? This is my first time with online judging and I am not sure what kind of problem this code is facing.

EDIT:

``````def p():
draw, balance = map (float,raw_input().split())

if draw % 5 == 0 and (draw + 0.5) <= balance:
balance -= (draw + 0.5)
print "%.2f" %balance

p()
``````

I have tried this also but this isn’t working either.

@anshbansal >> This is the AC version of your code.

``````if draw % 5 == 0 and draw <= (balance + 0.5)
``````

Correct line:

``````if draw % 5 == 0 and draw + 0.5 <= balance
``````

1 Like

@rakeshbubli143 >> Its called a hack!  Teach me @rakeshbubli143 >> What? Where 0 answer? Its showing 1 answer. dude… This isn’t working either.

``````def p():
draw, balance = map (float,raw_input().split())

if int(draw) % 5 == 0 and (draw + 0.5) < balance:
balance -= (draw + 0.5)
print "%.2f" %balance

p()
``````

Changes:

• `int(draw) % 5 == 0`
• `(draw + 0.5) < balance`
• Cleared indentation of print statement

Hope it helps, Best Luck Click on my solution. Click on “This” in my answer.

i think it can be (draw+0.5)<=balance, since condition possible when both are equal but still u can withdraw money… Actually (draw+ 0.5) <= balance works. I was messing up the indentation. Your code can fail if the balance is 55.5 and the draw is 55.

Got AC with same solution, see this link http://www.codechef.com/viewsolution/2201071

//