Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace zadacha
- {
- class Program
- {
- static void Main(string[] args)
- {
- /* •Datura Bombs: 40
- •Cherry Bombs: 60
- •Smoke Decoy Bombs: 120*/
- int datura = 0;
- int cherry = 0;
- int smoke = 0;
- bool pouch = false;
- int[] first = Console.ReadLine().Split(", ").Select(int.Parse).ToArray();
- int[] second = Console.ReadLine().Split(", ").Select(int.Parse).ToArray();
- Queue<int> effect = new Queue<int>(first);
- Stack<int> casing = new Stack<int>(second);
- while (effect.Any() && casing.Any())
- {
- if (datura >= 3 && cherry >= 3 && smoke >= 3)
- {
- pouch = true;
- break;
- }
- if (effect.Peek() + casing.Peek() == 40)
- {
- datura++;
- effect.Dequeue();
- casing.Pop();
- }
- else if (effect.Peek() + casing.Peek() == 60)
- {
- cherry++;
- effect.Dequeue();
- casing.Pop();
- }
- else if (effect.Peek() + casing.Peek() == 120)
- {
- smoke++;
- effect.Dequeue();
- casing.Pop();
- }
- else
- {
- casing.Push(casing.Pop()-5);
- }
- }
- if (pouch)
- {
- Console.WriteLine("Bene! You have successfully filled the bomb pouch!");
- }
- else
- {
- Console.WriteLine("You don't have enough materials to fill the bomb pouch.");
- }
- if (effect.Any())
- {
- Console.WriteLine($"Bomb Effects: {string.Join(", ", effect)}");
- }
- else
- {
- Console.WriteLine("Bomb Effects: empty");
- }
- if (casing.Any())
- {
- Console.WriteLine($"Bomb Casings: {string.Join(", ", casing)}");
- }
- else
- {
- Console.WriteLine("Bomb Casings: empty");
- }
- Console.WriteLine($"Cherry Bombs: {cherry}");
- Console.WriteLine($"Datura Bombs: {datura}");
- Console.WriteLine($"Smoke Decoy Bombs: {smoke}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement