ss3434

Untitled

Jun 28th, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. namespace Exam
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. var bombEffects = new Queue<int>(Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
  13.  
  14. var bombCasings = new Stack<int>(Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
  15.  
  16.  
  17. var bombi = new SortedDictionary<string, int>
  18. {
  19. { "Datura Bombs" ,0},
  20. { "Cherry Bombs" ,0},
  21. { "Smoke Decoy Bombs" ,0}
  22.  
  23. };
  24.  
  25.  
  26. while (bombEffects.Count > 0 && bombCasings.Count > 0 )//po 3tri da ima
  27. {
  28. if (bombi["Datura Bombs"]>=3 && bombi["Cherry Bombs"]>=3 && bombi["Smoke Decoy Bombs"] >= 3 )
  29. {
  30. break;
  31. }
  32. var currEfect = bombEffects.Peek();
  33. var currcasings = bombCasings.Peek();
  34. int sum = currEfect + currcasings;
  35. if (sum == 40)
  36. {
  37. bombi["Datura Bombs"]++;
  38. bombEffects.Dequeue();
  39. bombCasings.Pop();
  40. }
  41. else if (sum == 60)
  42. {
  43. bombi["Cherry Bombs"]++;
  44. bombEffects.Dequeue();
  45. bombCasings.Pop();
  46. }
  47. else if (sum == 120)
  48. {
  49. bombi["Smoke Decoy Bombs"]++;
  50. bombEffects.Dequeue();
  51. bombCasings.Pop();
  52. }
  53. else
  54. {
  55. bombCasings.Pop();
  56. bombCasings.Push(currcasings - 5);
  57.  
  58.  
  59.  
  60. }
  61.  
  62. }
  63.  
  64. if (bombi["Datura Bombs"] >= 3 && bombi["Cherry Bombs"] >= 3 && bombi["Smoke Decoy Bombs"] >= 3)
  65. {
  66. Console.WriteLine("Bene! You have successfully filled the bomb pouch!");
  67. }
  68. else
  69. {
  70. Console.WriteLine("You don't have enough materials to fill the bomb pouch.");
  71. }
  72.  
  73.  
  74. if (bombEffects.Count == 0)
  75. {
  76. Console.WriteLine("Bomb Effects: empty");
  77. }
  78. else
  79. {
  80. Console.WriteLine($"Bomb Effects: {string.Join(", ", bombEffects)}");
  81. }
  82.  
  83.  
  84. if (bombCasings.Count == 0)
  85. {
  86. Console.WriteLine("Bomb Casings: empty");
  87. }
  88. else
  89. {
  90. Console.WriteLine($"Bomb Casings: {string.Join(", ", bombCasings)}");
  91. }
  92.  
  93. foreach (var bomb in bombi)
  94. {
  95. Console.WriteLine($"{bomb.Key}: {bomb.Value}");
  96. }
  97. }
  98. }
  99. }
Add Comment
Please, Sign In to add comment