Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- var dict = new Dictionary<string, int>();
- dict["shards"] = 0;
- dict["fragments"] = 0;
- dict["motes"] = 0;
- var trasch= new Dictionary<string, int>();
- var isTrue = false;
- while(true)
- {
- var input = Console.ReadLine().Split();
- for(int i=0;i<input.Length;i+=2)
- {
- var material = input[i+1].ToLower();
- var quantity = int.Parse(input[i]);
- if(material == "shards" || material == "fragments" ||material=="motes")
- {
- dict[material] += quantity;
- if(dict[material] >= 250)
- {
- dict[material] -= 250;
- if(material == "shards")
- {
- Console.WriteLine("Shadowmourne obtained!");
- }
- else if(material == "fragments")
- {
- Console.WriteLine("Valanyr obtained!");
- }
- else
- {
- Console.WriteLine("Dragonwrath obtained!");
- }
- isTrue=true;
- break;
- }
- }
- else
- {
- if(!trasch.ContainsKey(material))
- {
- trasch[material] = new int();
- }
- trasch[material] += quantity;
- }
- }
- if(isTrue)
- {
- break;
- }
- }
- foreach(var kvp in dict.OrderByDescending(x=>x.Value).ThenBy(x=>x.Key))
- {
- Console.WriteLine($"{kvp.Key}: {kvp.Value}");
- }
- foreach(var kvp in trasch.OrderBy(x=>x.Key))
- {
- Console.WriteLine($"{kvp.Key}: {kvp.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement