Advertisement
kokusz19

Untitled

Dec 9th, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Korozgetes
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. Console.OutputEncoding = Encoding.UTF8;
  15.  
  16. StreamReader sr = new StreamReader(args[0]);
  17. string sor;
  18. string[] token;
  19. List<Verseny> lista = new List<Verseny>();
  20. int bennevan = 0;
  21.  
  22. while ((sor = sr.ReadLine()) != null)
  23. {
  24. token = sor.Split(';');
  25. foreach (Verseny item in lista)
  26. {
  27. if (item.versenyzo.Equals(token[0]))
  28. {
  29. item.korok += Int32.Parse(token[2]);
  30. bennevan = 1;
  31. }
  32. }
  33. if (bennevan == 0)
  34. lista.Add(new Verseny(token[0], token[1], Int32.Parse(token[2]), Int32.Parse(token[3])));
  35. bennevan = 0;
  36. }
  37.  
  38. lista = lista.OrderByDescending(x => x.korok).ThenBy(y=>y.versenyzo).ToList<Verseny>();
  39.  
  40. foreach (Verseny item in lista)
  41. {
  42. Console.WriteLine(item.versenyzo);
  43. }
  44. }
  45. }
  46.  
  47. class Verseny
  48. {
  49. public string versenyzo;
  50. public string helyszin;
  51. public int korok;
  52. public int helyezes;
  53.  
  54. public Verseny(string versenyzo, string helyszin, int korok, int helyezes)
  55. {
  56. this.versenyzo = versenyzo;
  57. this.helyszin = helyszin;
  58. this.korok = korok;
  59. this.helyezes = helyezes;
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement