Advertisement
viraco4a

Untitled

Mar 12th, 2018
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace CSGO
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. var itemPrices = new Dictionary<string, int>()
  11. {
  12. { "ak47", 2700 }, { "awp", 4750 }, { "sg553", 3500 }, { "grenade", 300 }, { "flash", 250 }, { "glock", 500 }, { "bazooka", 5600 }
  13. };
  14. int N = int.Parse(Console.ReadLine());
  15. if (N > 7)
  16. {
  17. Console.WriteLine("Sorry, you can't carry so many things!");
  18. return;
  19. }
  20. int budget = int.Parse(Console.ReadLine());
  21. int totalCost = 0;
  22. for (int i = 0; i < N; i++)
  23. {
  24. string input = Console.ReadLine();
  25. totalCost += itemPrices[input];
  26. }
  27. int diff = 0;
  28. if (totalCost > budget)
  29. {
  30. diff = totalCost - budget;
  31. Console.WriteLine($"Not enough money! You need {diff} more money.");
  32. }
  33. else
  34. {
  35. Console.WriteLine($"You bought all {N} items! Get to work and defeat the bomb!");
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement