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.Text;
- //using System.Threading.Tasks;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- long traineeCount = long.Parse(Console.ReadLine());
- Dictionary<string, decimal> result = new Dictionary<string, decimal>();
- result["Technical"] = 0.0m;
- result["Practical"] = 0.0m;
- result["Theoretical"] = 0.0m;
- for (int i = 0; i < traineeCount; i++)
- {
- long distanceInMiles = long.Parse(Console.ReadLine());
- decimal cargoInTons = decimal.Parse(Console.ReadLine());
- string teamName = Console.ReadLine();
- decimal cargoInKg = cargoInTons * 1000;
- decimal cargoProfit = cargoInKg * 1.5m;
- long distanceInMeters = distanceInMiles * 1600;
- decimal fuelConsuption = distanceInMeters * 0.7m;
- decimal expenses = fuelConsuption * 2.5m;
- decimal profit = cargoProfit - expenses;
- //if (!result.ContainsKey(teamName))
- //{
- // result.Add(teamName, profit);
- //}
- //else
- //{
- result[teamName] += profit;
- //}
- }
- decimal winnerProfit = result.Values.Max();
- string winnerTeam = result.FirstOrDefault(x => x.Value == winnerProfit).Key;
- Console.WriteLine($"The {winnerTeam} Trainers win with ${winnerProfit:F3}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement