Здравейте, ако някой ми каже защо гърми ще съм благодарен. Виждам теста, който гърми но има някакъв проблем понеже не би трябвало да дава грешка вижте и вие задължително през джъдж за да видите теста
https://pastebin.com/5UAZHgHv
Ето Условието:
7.Vending Machine
Your task is to calculate the total price of a purchase from a vending machine. Until you receive "Start" you will be given different coins that are being inserted in the machine. You have to sum them in order to have the total money inserted. There is a problem though. Your vending machine only works with 0.1, 0.2, 0.5, 1, and 2 coins. If someone tries to insert some other coins you have to display "Cannot accept {money}" and not add it to the total money. On the next few lines until you receive "End" you will be given products to purchase. Your machine has however only "Nuts", "Water", "Crisps", "Soda", "Coke". The prices are: 2.0, 0.7, 1.5, 0.8, 1.0 respectively. If the person tries to purchase a not existing product print “Invalid product”. Be careful that the person may try to purchase a product they don’t have the money for. In that case, print "Sorry, not enough money". If the person purchases a product successfully print "Purchased {product name}". After the “End” command print the money that is left formatted to the second decimal point in the format "Change: {money left}".
Examples
Input |
Output |
1 1 0.5 0.6 Start Coke Soda Crisps End |
Cannot accept 0.6 Purchased coke Purchased soda Sorry, not enough money Change: 0.70 |
Благодаря ви!
Много "мазно" решение :D ще го ползвам