Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace TempleExplorer
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Queue<int> toolQueue = new Queue<int>(Console.ReadLine().Split().Select(int.Parse));
- Stack<int> substanceStack = new Stack<int>(Console.ReadLine().Split().Select(int.Parse));
- List<int> challengeList = new List<int>(Console.ReadLine().Split().Select(int.Parse));
- while (toolQueue.Count > 0 && substanceStack.Count > 0)
- {
- int currentTool = toolQueue.Dequeue();
- int currentSubstance = substanceStack.Pop();
- int result = currentTool * currentSubstance;
- if (challengeList.Contains(result))
- {
- challengeList.Remove(result);
- }
- else
- {
- currentTool++;
- toolQueue.Enqueue(currentTool);
- currentSubstance--;
- if (currentSubstance > 0)
- {
- substanceStack.Push(currentSubstance);
- }
- }
- if (challengeList.Count == 0)
- {
- Console.WriteLine("Harry found an ostracon, which is dated to the 6th century BCE.");
- break;
- }
- }
- if (challengeList.Count > 0)
- {
- Console.WriteLine("Harry is lost in the temple. Oblivion awaits him.");
- }
- if (toolQueue.Count > 0)
- {
- Console.WriteLine($"Tools: {string.Join(", ", toolQueue)}");
- }
- if (substanceStack.Count > 0)
- {
- Console.WriteLine($"Substances: {string.Join(", ", substanceStack)}");
- }
- if (challengeList.Count > 0)
- {
- Console.WriteLine($"Challenges: {string.Join(", ", challengeList)}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement