anizko

11. *Snowballs 90/100

May 25th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _11._Snowballs
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int numberSnowballs = int.Parse(Console.ReadLine());
  10.  
  11.             ulong theBestSnowballs = 0;
  12.             int theBestSnowballSnow = 0;
  13.             int theBestSnowballTime = 0;
  14.             int theBestSnowballQuality = 0;
  15.  
  16.  
  17.  
  18.             for (int i = 1; i <= numberSnowballs; i++)
  19.             {
  20.                 int snowballSnow = int.Parse(Console.ReadLine());
  21.                 int snowballTime = int.Parse(Console.ReadLine());
  22.                 int snowballQuality = int.Parse(Console.ReadLine());
  23.                 ulong snowballValue = (ulong) Math.Pow((snowballSnow / snowballTime), snowballQuality);
  24.  
  25.                 if (snowballValue > theBestSnowballs)
  26.                 {
  27.                     theBestSnowballs = snowballValue;
  28.                     theBestSnowballSnow = snowballSnow;
  29.                     theBestSnowballTime = snowballTime;
  30.                     theBestSnowballQuality = snowballQuality;
  31.  
  32.                 }
  33.  
  34.             }
  35.             Console.WriteLine($"{theBestSnowballSnow} : {theBestSnowballTime} = {theBestSnowballs} ({theBestSnowballQuality})");
  36.  
  37.  
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment