Advertisement
Guest User

01. Trainers

a guest
Aug 22nd, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _01.Trainers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Dictionary<string, double> teams = new Dictionary<string, double> {
  14.                 { "Technical",0},
  15.                 { "Theoretical",0},
  16.                 { "Practical",0}
  17.             };
  18.             int n = int.Parse(Console.ReadLine());
  19.  
  20.             for (int i = 0; i < n; i++)
  21.             {
  22.                 long distance = long.Parse(Console.ReadLine());
  23.                 double cargo = double.Parse(Console.ReadLine());
  24.                 string team = Console.ReadLine().Trim();
  25.                 cargo *= 1000;
  26.                 distance *= 1600;
  27.                 double earned = (cargo * 1.5) - (0.7*distance*2.5);
  28.                 teams[team] += earned;
  29.             }
  30.  
  31.             var winner = teams.OrderByDescending(t => t.Value).First();
  32.             Console.WriteLine("The {0} Trainers win with ${1:F3}.",winner.Key,winner.Value);
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement