You are viewing a single comment's thread. Return to all comments →
my solution in c#
{ int n = Convert.ToInt32(Console.ReadLine()); List<Player> players = new List<Player>(); for (int i = 0; i < n; i++) { string[] input = Console.ReadLine().Split(' '); players.Add( new Player { Name = input[0], Score = Convert.ToInt64(input[1]) }); } Console.Clear(); var list = players.OrderByDescending(p => p.Score).ThenBy(p => p.Name); foreach(Player p in list) { Console.WriteLine(p.Name + " " + p.Score); } Console.ReadLine(); } class Player { public long Score { get; set; } public string Name { get; set; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Sorting: Comparator
You are viewing a single comment's thread. Return to all comments →
my solution in c#