Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Security.Cryptography.X509Certificates;
- using System.Text;
- using System.Threading.Tasks;
- namespace _01.Trainers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var teamAndMoney = new Dictionary<string, decimal>();
- for (int i = 0; i < n; i++)
- {
- var distance = long.Parse(Console.ReadLine());
- var cargo = long.Parse(Console.ReadLine());
- string team = Console.ReadLine();
- distance = distance * 1600;
- cargo = cargo * 1000;
- var money = (cargo * 1.5M) - (0.7M * distance * 2.5M);
- if (teamAndMoney.ContainsKey(team))
- {
- teamAndMoney[team] += money;
- }
- else
- {
- teamAndMoney.Add(team, money);
- }
- }
- var winner = teamAndMoney.OrderByDescending(x => x.Value).FirstOrDefault();
- // var mostmoney = teamAndMoney.FirstOrDefault(x => x.Value == teamAndMoney.Values.Max()).Key;
- Console.WriteLine($"The {winner.Key} Trainers win with ${winner.Value:F3}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement