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.Text.RegularExpressions;
- namespace exam
- {
- class exam
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- double techMoney = 0.0;
- double theorMoney = 0.0;
- double practMoney = 0.0;
- for (int i = 0; i < n; i++)
- {
- int dist = int.Parse(Console.ReadLine()) * 1600;
- double cargo = double.Parse(Console.ReadLine()) * 1000;
- string team = Console.ReadLine();
- switch (team)
- {
- case "Technical":
- techMoney += cargo * 1.5 - 0.7 * dist * 2.5;
- break;
- case "Theoretical":
- theorMoney += cargo * 1.5 - 0.7 * dist * 2.5;
- break;
- case "Practical":
- practMoney += cargo * 1.5 - 0.7 * dist * 2.5;
- break;
- }
- }
- List<double> result = new List<double>() { techMoney, theorMoney, practMoney};
- int maxIndex = -1;
- double maxValue = int.MinValue;
- int t = 0;
- foreach (int v in result)
- {
- if ((maxIndex < 0) || (v > maxValue))
- {
- maxValue = v;
- maxIndex = t;
- }
- t++;
- }
- string teamPrint = "";
- switch (maxIndex)
- {
- case 0:
- teamPrint = "Technical";
- break;
- case 1:
- teamPrint = "Theoretical";
- break;
- case 2:
- teamPrint = "Practical";
- break;
- }
- Console.WriteLine($"The {teamPrint} Trainers win with ${maxValue:f3}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement