Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. namespace Application
  7. {
  8. class Data
  9. {
  10. public int ID;
  11. public int M;
  12. public Data(int id, int m)
  13. {
  14. this.ID = id;
  15. this.M = m;
  16. }
  17. public override string ToString()
  18. {
  19. return string.Format("{0} {1}", this.ID, this.M);
  20. }
  21. }
  22. class MainClass
  23. {
  24. public static void Main(string[] args)
  25. {
  26. var list = new List<Data>();
  27. var n = int.Parse(Console.ReadLine());
  28. for (var i = 0; i < n; i++)
  29. {
  30. var str = Console.ReadLine().Split(' ');
  31. list.Add(new Data(int.Parse(str[0]), int.Parse(str[1])));
  32. }
  33. list.OrderByDescending(x => x.M).ToList().ForEach(x => Console.WriteLine(x.ToString()));
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement