What's wrong with my submission?

This is the problem : [ATM][1]

This is my submitted solution : [Solution][2]

I dunno what is wrong with the solution. It says WA. Please help.
[1]: https://www.codechef.com/problems/HS08TEST
[2]: https://www.codechef.com/viewsolution/13798260

@vijju123 are u here?

Your code fails here-

50 50.00

Your Output

Expected Output
50.00 (as "If there is not enough money in the account to complete the transaction (+the bank fees), output the current bank balance.")
1 Like

Problem with your code-

  1. Try to find details in the problem like when to use < and when to use <=.

  2. You didn’t take into account the extra charges the bank requires of 0.05 for every transaction done. So your current balance should be withdrawl amount + $0.05.

Solution -

Just change the following line of your code - if(x%5==0&&x<=y) to - if(x%5==0&&x+0.05<y)

1 Like

@vijju123, i corrected my solution. still WA. New Solution

No, its not correct. The total cost in my test case is 50.50, while balance had only $50. Re-check the expected output

1 Like

got that. :slight_smile:

You may need to change this condition-


Make it check if her balance> withdrawing amount+0.5

1 Like

got AC. thanks :slight_smile:

1 Like

Your welcome dear :slight_smile: