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]: HS08TEST Problem - CodeChef
[2]: CodeChef: Practical coding for everyone
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]: HS08TEST Problem - CodeChef
[2]: CodeChef: Practical coding for everyone
Your code fails here-
Input
50 50.00
Your Output
-0.50
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.")
Problem with your code-
Try to find details in the problem like when to use < and when to use <=.
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)
No, its not correct. The total cost in my test case is 50.50, while balance had only $50. Re-check the expected output
got that.
You may need to change this condition-
“if(x%5==0&&x<=y)”
Make it check if her balance> withdrawing amount+0.5
got AC. thanks
Your welcome dear