namespace _11.Dragon_Army
{
using System;
using System.Linq ;
using System.Collections .Generic ;
public class Program
{
public static void Main( )
{
var linesCount = int .Parse ( Console.ReadLine ( ) ) ;
var dragonsData = new Dictionary< string, SortedDictionary< string, int [ ] >> ( ) ;
var dragonStats = new Dictionary< string, int> ( ) ;
for ( int i = 0 ; i < linesCount; i++ )
{
var input = Console.ReadLine ( ) ;
var splittedInput = input.Split ( ' ' ) .ToArray ( ) ;
var dragonType = splittedInput[ 0 ] ;
var dragonName = splittedInput[ 1 ] ;
var damage = splittedInput[ 2 ] == "null" ? 45 : int .Parse ( splittedInput[ 2 ] ) ;
var health = splittedInput[ 3 ] == "null" ? 250 : int .Parse ( splittedInput[ 3 ] ) ;
var armor = splittedInput[ 4 ] == "null" ? 10 : int .Parse ( splittedInput[ 4 ] ) ;
if ( ! dragonsData.ContainsKey ( dragonType) )
{
dragonsData[ dragonType] = new SortedDictionary< string, int [ ] > ( ) ;
}
if ( ! dragonsData[ dragonType] .ContainsKey ( dragonName) )
{
dragonsData[ dragonType] [ dragonName] = new int [ 3 ] ;
}
dragonsData[ dragonType] [ dragonName] [ 0 ] = damage;
dragonsData[ dragonType] [ dragonName] [ 1 ] = health;
dragonsData[ dragonType] [ dragonName] [ 2 ] = armor;
}
GetResult( dragonsData) ;
}
static void GetResult( Dictionary< string, SortedDictionary< string, int [ ] >> dragonsData)
{
foreach ( var dragonType in dragonsData)
{
Console.WriteLine ( "{0}::({1:f}/{2:f}/{3:f})" , dragonType.Key , dragonType.Value .Select ( x=> x.Value [ 0 ] ) .Average ( ) ,
dragonType.Value .Select ( x => x.Value [ 1 ] ) .Average ( ) , dragonType.Value .Select ( x => x.Value [ 2 ] ) .Average ( ) ) ;
foreach ( var dragonNameAndStats in dragonType.Value )
{
Console.WriteLine ( @"-{0} -> damage: {1}, health: {2}, armor: {3}" , dragonNameAndStats.Key , dragonNameAndStats.Value [ 0 ] ,
dragonNameAndStats.Value [ 1 ] , dragonNameAndStats.Value [ 2 ] ) ;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yc2Uoc3BsaXR0ZWRJbnB1dFszXSk7CiAgICAgICAgICAgICAgICB2YXIgYXJtb3IgPSBzcGxpdHRlZElucHV0WzRdID09ICJudWxsIiA/IDEwIDogaW50LlBhcnNlKHNwbGl0dGVkSW5wdXRbNF0pOwoKICAgICAgICAgICAgICAgIGlmICghZHJhZ29uc0RhdGEuQ29udGFpbnNLZXkoZHJhZ29uVHlwZSkpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZHJhZ29uc0RhdGFbZHJhZ29uVHlwZV0gPSBuZXcgU29ydGVkRGljdGlvbmFyeTxzdHJpbmcsIGludFtdPigpOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIGlmICghZHJhZ29uc0RhdGFbZHJhZ29uVHlwZV0uQ29udGFpbnNLZXkoZHJhZ29uTmFtZSkpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZHJhZ29uc0RhdGFbZHJhZ29uVHlwZV1bZHJhZ29uTmFtZV0gPSBuZXcgaW50WzNdOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIGRyYWdvbnNEYXRhW2RyYWdvblR5cGVdW2RyYWdvbk5hbWVdWzBdID0gZGFtYWdlOwogICAgICAgICAgICAgICAgZHJhZ29uc0RhdGFbZHJhZ29uVHlwZV1bZHJhZ29uTmFtZV1bMV0gPSBoZWFsdGg7CiAgICAgICAgICAgICAgICBkcmFnb25zRGF0YVtkcmFnb25UeXBlXVtkcmFnb25OYW1lXVsyXSA9IGFybW9yOwogICAgICAgICAgICB9CgogICAgICAgICAgICBHZXRSZXN1bHQoZHJhZ29uc0RhdGEpOwogICAgICAgIH0KCiAgICAgICAgc3RhdGljIHZvaWQgR2V0UmVzdWx0KERpY3Rpb25hcnk8c3RyaW5nLCBTb3J0ZWREaWN0aW9uYXJ5PHN0cmluZywgaW50W10+PiBkcmFnb25zRGF0YSkKICAgICAgICB7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciBkcmFnb25UeXBlIGluIGRyYWdvbnNEYXRhKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiezB9OjooezE6Zn0vezI6Zn0vezM6Zn0pIixkcmFnb25UeXBlLktleSxkcmFnb25UeXBlLlZhbHVlLlNlbGVjdCh4PT54LlZhbHVlWzBdKS5BdmVyYWdlKCksCiAgICAgICAgICAgICAgICAgZHJhZ29uVHlwZS5WYWx1ZS5TZWxlY3QoeCA9PiB4LlZhbHVlWzFdKS5BdmVyYWdlKCksIGRyYWdvblR5cGUuVmFsdWUuU2VsZWN0KHggPT4geC5WYWx1ZVsyXSkuQXZlcmFnZSgpKTsKCiAgICAgICAgICAgICAgICBmb3JlYWNoICh2YXIgZHJhZ29uTmFtZUFuZFN0YXRzIGluIGRyYWdvblR5cGUuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoQCItezB9IC0+IGRhbWFnZTogezF9LCBoZWFsdGg6IHsyfSwgYXJtb3I6IHszfSIsZHJhZ29uTmFtZUFuZFN0YXRzLktleSxkcmFnb25OYW1lQW5kU3RhdHMuVmFsdWVbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgZHJhZ29uTmFtZUFuZFN0YXRzLlZhbHVlWzFdLCBkcmFnb25OYW1lQW5kU3RhdHMuVmFsdWVbMl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9
stdout
stderr
Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0
at _11.Dragon_Army.Program.Main () [0x00005] in <cc57ae365e9941119eb41da26458e5b5>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: String
at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0
at _11.Dragon_Army.Program.Main () [0x00005] in <cc57ae365e9941119eb41da26458e5b5>:0