Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- var bombEffects = new Queue<int>(Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
- var bombCasings = new Stack<int>(Console.ReadLine().Split(", ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray());
- var bombi = new SortedDictionary<string, int>
- {
- { "Datura Bombs" ,0},
- { "Cherry Bombs" ,0},
- { "Smoke Decoy Bombs" ,0}
- };
- while (bombEffects.Count > 0 && bombCasings.Count > 0 )//po 3tri da ima
- {
- if (bombi["Datura Bombs"]>=3 && bombi["Cherry Bombs"]>=3 && bombi["Smoke Decoy Bombs"] >= 3 )
- {
- break;
- }
- var currEfect = bombEffects.Peek();
- var currcasings = bombCasings.Peek();
- int sum = currEfect + currcasings;
- if (sum == 40)
- {
- bombi["Datura Bombs"]++;
- bombEffects.Dequeue();
- bombCasings.Pop();
- }
- else if (sum == 60)
- {
- bombi["Cherry Bombs"]++;
- bombEffects.Dequeue();
- bombCasings.Pop();
- }
- else if (sum == 120)
- {
- bombi["Smoke Decoy Bombs"]++;
- bombEffects.Dequeue();
- bombCasings.Pop();
- }
- else
- {
- bombCasings.Pop();
- bombCasings.Push(currcasings - 5);
- }
- }
- if (bombi["Datura Bombs"] >= 3 && bombi["Cherry Bombs"] >= 3 && bombi["Smoke Decoy Bombs"] >= 3)
- {
- 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 (bombEffects.Count == 0)
- {
- Console.WriteLine("Bomb Effects: empty");
- }
- else
- {
- Console.WriteLine($"Bomb Effects: {string.Join(", ", bombEffects)}");
- }
- if (bombCasings.Count == 0)
- {
- Console.WriteLine("Bomb Casings: empty");
- }
- else
- {
- Console.WriteLine($"Bomb Casings: {string.Join(", ", bombCasings)}");
- }
- foreach (var bomb in bombi)
- {
- Console.WriteLine($"{bomb.Key}: {bomb.Value}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment