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 _01.Trainers
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, decimal> teamReg = new Dictionary<string, decimal>();
- teamReg["Theoretical"] = 0M;
- teamReg["Technical"] = 0M;
- teamReg["Practical"] = 0M;
- // ТРЯБВА ЗАДЪЛЖИТЕЛНО да се зададе default подредени отбори
- // защото ако имаме за например ... тест
- // ## Input
- //2
- //0
- //0
- //Technical
- //0
- //0
- //Practical
- // Изхода който ще искаме ще бъде :
- // ## Output
- // The Theoretical Trainers win with $0.000.
- // Иначе тест №6 ще дава грещка защото ще иска изход с Theoretical Trainers като печелещия отбор
- int numberOfParticipants = int.Parse(Console.ReadLine());
- for (int i = 0; i < numberOfParticipants; i++)
- {
- decimal distanceInMeters = decimal.Parse(Console.ReadLine()) * 1600M;
- decimal cargoInKillograms = decimal.Parse(Console.ReadLine()) * 1000M;
- string typeOfTeam = Console.ReadLine();
- decimal participantEarnedMoney =
- (cargoInKillograms * 1.5m) - (0.7m * distanceInMeters * 2.5m);
- if (teamReg.ContainsKey(typeOfTeam))
- {
- teamReg[typeOfTeam] += participantEarnedMoney;
- }
- }
- // Output
- var participant = teamReg.OrderByDescending(x => x.Value).First();
- Console.WriteLine($"The {participant.Key} Trainers win with ${participant.Value:F3}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement