Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Korozgetes
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.OutputEncoding = Encoding.UTF8;
- StreamReader sr = new StreamReader(args[0]);
- string sor;
- string[] token;
- List<Verseny> lista = new List<Verseny>();
- int bennevan = 0;
- while ((sor = sr.ReadLine()) != null)
- {
- token = sor.Split(';');
- foreach (Verseny item in lista)
- {
- if (item.versenyzo.Equals(token[0]))
- {
- item.korok += Int32.Parse(token[2]);
- bennevan = 1;
- }
- }
- if (bennevan == 0)
- lista.Add(new Verseny(token[0], token[1], Int32.Parse(token[2]), Int32.Parse(token[3])));
- bennevan = 0;
- }
- lista = lista.OrderByDescending(x => x.korok).ThenBy(y=>y.versenyzo).ToList<Verseny>();
- foreach (Verseny item in lista)
- {
- Console.WriteLine(item.versenyzo);
- }
- }
- }
- class Verseny
- {
- public string versenyzo;
- public string helyszin;
- public int korok;
- public int helyezes;
- public Verseny(string versenyzo, string helyszin, int korok, int helyezes)
- {
- this.versenyzo = versenyzo;
- this.helyszin = helyszin;
- this.korok = korok;
- this.helyezes = helyezes;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement