Advertisement
Guest User

i suck

a guest
Apr 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 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 Raindrops
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double n = int.Parse(Console.ReadLine());
  14.             double technical = 0;
  15.             double theoretical = 0;
  16.             double practical = 0;
  17.             double participantEarnedMoney = 0;
  18.             for (int i = 0; i < n; i++)
  19.             {
  20.                 double metres = double.Parse(Console.ReadLine()) * 1600;
  21.                 double kilogram = double.Parse(Console.ReadLine()) * 1000;
  22.                 string team = (Console.ReadLine());
  23.                
  24.                 double fuelExpenses = 0.7 * metres * 2.5; //decimal
  25.                 double cargoIncome = 1.5 * kilogram;
  26.                  participantEarnedMoney = cargoIncome - fuelExpenses;
  27.                 //Console.WriteLine(participantEarnedMoney);
  28.                 if (team=="Technical")
  29.                 {
  30.                      technical = participantEarnedMoney;
  31.                 }
  32.                 else if (team == "Theoretical")
  33.                 {
  34.                      theoretical = participantEarnedMoney;
  35.                 }
  36.                 else if (team == "Practical")
  37.                 {
  38.                      practical = participantEarnedMoney;
  39.                 }
  40.             }
  41.             double end = Math.Max(technical, Math.Max(theoretical, practical));
  42.             if (end==technical)
  43.                 {
  44.                     Console.WriteLine($"The Technical Trainers win with ${participantEarnedMoney:F3}.");
  45.                 }
  46.             else if (end == theoretical)
  47.             {
  48.                 Console.WriteLine($"The Theoretical Trainers win with ${participantEarnedMoney:F3}.");
  49.             }
  50.             else if (end == practical)
  51.             {
  52.                 Console.WriteLine($"The Theoretical Trainers win with ${participantEarnedMoney:F3}.");
  53.             }
  54.  
  55.  
  56.  
  57.  
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement