ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Economics & Finance > задача:


51039 - Automated billing system

Гость
• Вопросы к жюри (3)

Задачи раздела

• 51040 - Annual profit
• 51038 - Simple interest
• 51039 - Automated billing system
• 50482 - Bank Charges
• 50491 - Brokers
• 50806 - TVSH
• 50514 - Bookkeeping
• 50523 - Total Tax to Pay
• 50534 - Top Trading Company
• 50405 - Accounts Receivable
• 50958 - ATM

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
bfs.

Automated billing system

Question: 

Today’s supermarkets and hypermarkets to avoid the queue of customers for paying their products that they have bought they put some computers where customer can pay himself.

The customer scans all products on machine and the computer shows total amount that customer has to pay. After the customer inserts money the computer has to check if given amount of money is enough for payment or not.

  • If it is not enough, prints “Not Enough”
  • If given amount of money is equal with total amount that customer has to pay it prints: “Thank You”
  • If exceeds it calculates how many 100 lek, 50 lek, 20 lek, 10 lek, 5 lek and 1 lek coins should machine returns back.

Write a program that does the described job.

Input Specification: You will be given prices of four products 0<price1,price2,price3,price4<=30000,  then the amount of money that customer inserts to machine 1<amount<=12000.

Output Specification: According to the amount of money given by user print one of the following outputs:

  • “Not Enough”
  • “Thank You”
  • Number of 100 lek, 50 lek, 20 lek, 10 lek, 5 lek, 2 lek and 1 lek coins
Sample Input I  
40 50 30 70
160
Sample Input II
35 40 20 50
145
Sample Input III
29 16 75 15
500
Sample Output I
Not Enough
Sample Output II
Thank You
Sample Output III
3 1 0 1 1 0 0

 

Sample Input II Explanation:

Total amount of products is 29+16+75+15=135;

Amount of money given by user is =500, so the difference is 500-135=365, because the difference is greater than zero machine has to calculate the number of coins .

Number of:

  • 100 lek coins: difference /100 =>365/100=> 3 coins
  • 50 lek coins:  Subtract  “100 lek” coins from the difference.

                              difference= difference-(3*100)=365-300=65,

                              difference/50=> 65/50=> 1 coins. 

  • 20 lek coins: Subtract  “50 lek” coins from the difference.

                             difference= difference-(1*50)=65-50=15,

                             difference/20=> 15/20=> 0 coins. 

  • 10 lek coins: Subtract  “20 lek” coins from the difference.

                             difference= difference-(0*20)=15-0=15,

                             difference/10=> 15/10=> 1 coins. 

  • 5 lek coins: Subtract  “10 lek” coins from the difference.

                            difference= difference-(1*10)=15-10=5,

                            difference/5=> 5/5=> 1 coins. 

  • 2 lek coins: Subtract  “5 lek” coins from the difference.

                            difference= difference-(1*5)=5-5=0,

                            difference/1=> 0/1=> 0 coins.

  • 1 lek coins: Subtract  “2 lek” coins from the difference.

                            difference= difference-(0*2)=0-0=0,

                            difference/1=> 0/1=> 0 coins.

So the output is: 3 1 0 1 1 0 0.

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

www.contester.ru