Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace DragonArmy
- {
- class Program
- {
- public static object Dicitionary { get; private set; }
- static void Main(string[] args)
- {
- //Red Bazgargal 100 2500 25
- //for
- //{type} {name} {damage} {health} {armor}.
- var iteration = int.Parse(Console.ReadLine());
- Dictionary<string, Dictionary<string, List<int>>> data = new Dictionary<string, Dictionary<string, List<int>>>();
- for (int i = 0; i < iteration; i++)
- {
- string[] input = Console.ReadLine().Split(' ').ToArray();
- var type = input[0];
- var name =input[1];
- //
- var damage = 0;
- var health = 0;
- var armour = 0;
- if (input[2] == "null")
- {
- damage = 45;
- }
- if (input[2] != "null")
- {
- damage = int.Parse(input[2]);
- }
- if (input[3] == "null")
- {
- health = 250;
- }
- if (input[3] != "null")
- {
- health = int.Parse(input[3]);
- }
- if (input[4] == "null")
- {
- armour = 10;
- }
- if (input[4] != "null")
- {
- armour = int.Parse(input[4]);
- }
- //
- if (!data.ContainsKey(type))
- {
- data.Add(type, new Dictionary<string, List<int>>());
- }
- if (!data[type].ContainsKey(name))
- {
- data[type].Add(name, new List<int>());
- }
- List<int> current = new List<int>();
- current.Add(damage);
- current.Add(health);
- current.Add(armour);
- data[type][name] = current;
- }
- foreach (var dragon in data)
- {
- var midHealth = 0;
- var midDamage = 0;
- var midArmour = 0;
- var count = dragon.Value.Count();
- foreach (var pro in dragon.Value)
- {
- midHealth += pro.Value[1];
- midArmour += pro.Value[2];
- midDamage += pro.Value[0];
- }
- Console.WriteLine(dragon.Key+$"::({midDamage*1.0/count:f2}/{midHealth*1.0/count:f2}/{midArmour * 1.0 / count:f2})");
- foreach (var properties in dragon.Value.OrderBy(x => x.Key))
- {
- Console.Write("-"+properties.Key+ " -> ");
- Console.Write($"damage: {properties.Value[0]}, health: {properties.Value[1]}, armor: {properties.Value[2]}");
- midDamage += properties.Value[0];
- midHealth += properties.Value[1];
- midArmour += properties.Value[2];
- Console.WriteLine();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement