Problem
Pooja would like to withdraw X $US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges). For each successful withdrawal the bank charges 0.50 $US.
Calculate Pooja's account balance after an attempted transaction.
Input Format
Each input contains 2 integers and .
is the amount of cash which Pooja wishes to withdraw.
is Pooja's initial account balance.
Output Format
Output the account balance after the attempted transaction, given as a number with two digits of precision. If there is not enough money in the account to complete the transaction, output the current bank balance.
Constraints
- - the amount of cash which Pooja wishes to withdraw.
- with two digits of precision - Pooja's initial account balance.
Sample 1:
30 120.00
89.50
Explanation:
Example - Successful Transaction
Sample 2:
42 120.00
120.00
Explanation:
Example - Incorrect Withdrawal Amount (not multiple of 5)
Sample 3:
300 120.00
120.00
Explanation:
Example - Insufficient Funds
Comments
Post a Comment