0.1 Blacksmith 90/100 не виждам от къде идеи?
using System;
using System.Collections.Generic;
using System.Linq;
namespace Defining_classes
{
class Program
{
static void Main(string[] args)
{
int swordss = 0;
int[] steel1 = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
Queue<int> steel = new Queue<int>(steel1);
int[] carbonn = Console.ReadLine().Split(" ",StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
Stack<int> carbon = new Stack<int>(carbonn);
Dictionary<string, int> swords = new Dictionary<string, int>();
while (steel.Count>0&&carbon.Count>0)
{
int S = steel.Dequeue();
int C=carbon.Pop();
int sum = S + C;
if (sum == 70 )
{
if ( swords.ContainsKey("Gladius"))
{
swords["gladius"] += 1;
swordss++;
}
else
{
swords.Add("Gladius",1);
swordss++;
}
}
else if (sum == 80 )
{
if ( swords.ContainsKey("Shamshir"))
{
swords["Shamshir"] += 1;
swordss++;
}
else
{
swords.Add("Shamshir",1);
swordss++;
}
}
else if (sum == 90 )
{
if ( swords.ContainsKey("Katana"))
{
swords["Katana"] += 1; swordss++;
}
else
{
swords.Add("Katana",1); swordss++;
}
}
else if (sum == 110 )
{
if ( swords.ContainsKey("Sabre"))
{
swords["Sabre"] += 1; swordss++;
}
else
{
swords.Add("Sabre",1); swordss++;
}
}
else if (sum == 150 )
{
if ( swords.ContainsKey("Broadsword"))
{
swords["Broadsword"] += 1; swordss++;
}
else
{
swords.Add("Broadsword", 1); swordss++;
}
}
else
{
carbon.Push(C + 5);
}
}
if (swordss==0)
{
Console.WriteLine("You did not have enough resources to forge a sword.");
}
else
{
Console.WriteLine($"You have forged { swordss} swords.");
}
if (steel.Count==0)
{
Console.WriteLine("Steel left: none");
}
else
{
Console.Write("Steel left: ");
Console.WriteLine(string.Join(", ",steel));
}
if (carbon.Count==0)
{
Console.WriteLine("Carbon left: none");
}
else
{
Console.Write("Carbon left: ");
Console.WriteLine(string.Join(", ",carbon));
}
swords = swords.OrderBy(X => X.Key).ToDictionary(x=>x.Key,x=>x.Value);
foreach (var item in swords)
{
Console.WriteLine($"{item.Key}: {item.Value}");
}
}
}
}