Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05.FanShop
- {
- class Program
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- int qty = int.Parse(Console.ReadLine());
- int totalSum = 0;
- for (int i = 0; i < qty; i++)
- {
- string article = Console.ReadLine();
- switch (article)
- {
- case "hoodie":
- totalSum +=30;
- break;
- case "keychain":
- totalSum += 4;
- break;
- case "T-shirt":
- totalSum += 20;
- break;
- case "flag":
- totalSum += 15;
- break;
- case "sticker":
- totalSum += 1;
- break;
- default: break;
- }
- }
- if (budget >= totalSum)
- {
- Console.WriteLine($"You bought {qty} items and left with {budget - totalSum} lv.");
- }
- else
- {
- Console.WriteLine($"Not enough money, you need {totalSum - budget} more lv.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment