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

Разделы > Арифметика > задача:


51029 - Buy Three Items

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

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

• Cineplexx
• Cirku Belluci
• 50659 - Covariance Matrix
• El Clasico
• 50657 - Permutations and Combinat...
• 50658 - The Message
• 50916 - Ascending Numbers
• 50917 - Descending Numbers
• 51029 - Buy Three Items
• 51032 - Triangle Property
• 51033 - Sum of the series
• 51027 - Download Percentage
• 51028 - Isosceles Triangles
• 51031 - Convert from Hex to Dec
• 51030 - Number of Right Triangles
• 50553 - I pjestueshem me 2013
• 50554 - Fuqia e n-t e m (2)

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Buy Three Items

Question: You have m leke and you want to buy 3 items. You want to buy the items in order (you will buy the first item and if you have more money then you will buy the second one, etc. ) How many items you can buy?

Input specification: You will be first given 3 integer numbers, the total amounts of three items (at,bt,ct). On the next line, the total amount (m) you have. All the numbers are integers not greater than 10 million.

Output specification: Show one number, the number of items that you can buy.

Sample Input I
70 50 80
160
Sample Input II
120 30 50
100
Sample Output I
2
Sample Output II
0

Explanation: You will buy the items in order. For the first sample, you have the money to buy the first and second items (2) but you don't have enough money to buy the third one. For the second sample, Although you have enough money to buy the second and third items, but you are buying the items in order. So, you don't have enough money to buy the first one, And thus, you buy no items (0).

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

www.contester.ru