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

Турниры > CEN109/111_2016_Questions > задача:


PE12. 51039 - Automated billing system

CEN109/111_2016_Questions

Старт: 07.дек.2016 в 12:37:00
Финиш: 07.дек.2016 в 13:42:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• PE04. 51030 - Number of Right Tria...
• PE05. 51031 - Convert from Hex to...
• PE06. 51032 - Triangle Property
• PE07. 51033 - Sum of the series
• PE08. 51034 - Area of 3 Shapes
• PE09. 51040 - Annual profit
• PE10. 51041 - Plane Segmentation
• PE11. 51038 - Simple interest
• PE12. 51039 - Automated billing...
• RE1. 51077 - Grades Histogram
• RE2. 51078 - Max trade
• hw3. 51057 - Number of students
• hw4. 51058 - Third grade students
• hw5. 51059 - Football teams
• hw6. 51060 - Public Transportation

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

Если у вас есть предложения или пожелания по работе 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