HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Beginners > problem:


50430 - ATM

Guest
• Review clarifications (1)

Volume problems

• 51041 - Plane Segmentation
• 51039 - Automated billing system
• 50310 - Kinetic Energy
• 50314 - Falling Distance
• El Clasico
• 50481 - Car Parking
• 50480 - What quadrant is it?
• 50482 - Bank Charges
• 50430 - ATM
• 50292 - Average of 4 Marks
• 50799 - OSHEE Electric Bill
• 51029 - Buy Three Items
• 51034 - Area of 3 Shapes
• 51032 - Triangle Property
• 51033 - Sum of the series
• 51027 - Download Percentage
• 51028 - Isosceles Triangles

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Halil Karimis.

ATM

Question: Ardit 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 Ardit'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 Ardit's account balance after an attempted transaction.

Input specification
Positive integer X (0 < X ≤ 2000) - the amount of cash which Ardit wishes to withdraw.
Nonnegative number Y (0 ≤ Y ≤ 2000) - Ardit's initial account balance.

Output specification
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 or X is not a multiple of 5, output the current bank balance.

 Sample Input I     Sample Input II     Sample Input III   
 30 90.56789
 42 120.00
 300 120.00
 Sample Output I     Sample Output II     Sample Output III   
 60.07
 120.00
 120.00

Explanation:

  1. Regular transaction
  2. The amount to withdraw is not a multiple of 5
  3. The amount to withdraw is greater than the amount he has in the account

Для отправки решений необходимо выполнить вход.

www.contester.ru