Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. class Program
  5. {
  6.     static void Main()
  7.     {
  8.         long traineeCount = long.Parse(Console.ReadLine());
  9.         Dictionary<string, decimal> result = new Dictionary<string, decimal>();
  10.         result.Add("Technical", 0);
  11.         result.Add("Practical", 0);
  12.         result.Add("Theoretical", 0);
  13.  
  14.         for (int i = 0; i < traineeCount; i++)
  15.         {
  16.             long distanceInMiles = long.Parse(Console.ReadLine());
  17.             decimal cargoInTons = decimal.Parse(Console.ReadLine());
  18.             string teamName = Console.ReadLine();
  19.  
  20.             decimal profit = cargoInTons * 1000 * 1.5m - distanceInMiles * 1600 * 0.7m * 2.5m;
  21.  
  22.             result[teamName] += profit;
  23.  
  24.         }
  25.         decimal winnerProfit = result.Values.Max();
  26.         string winnerTeam = result.FirstOrDefault(x => x.Value == winnerProfit).Key;
  27.  
  28.         Console.WriteLine($"The {winnerTeam} Trainers win with ${winnerProfit:F3}.");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement