Submit | All submissions | Best solutions | Back to list |
NITK04 - DEEPIKA AND HER BANK ACCOUNT |
Ranbir has deposited some money in Deepika's account. Deepika would like to withdraw X $US from an ATM. The ATM machine will only accept the transaction if X is a multiple of 10, and Deepika'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 Deepika's account balance after an attempted transaction.
Input
The first like contains T (T < 20), the number of test cases followed by T lines each containing X and Y.
Positive integer 0 < X <= 2000 - the amount of cash which Deepika wishes to withdraw.
Nonnegative number 0 <= Y <= 2000 with two digits of precision - Deepika's initial account balance.
Output
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.
Example
Input: 2 30 120.00 42 120.00 Output: 89.50 120.00
Added by: | Gaurav Jain |
Date: | 2013-09-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | CodeChef |