Advertisement
Dianov

Data Types and Variables - Exercise (11. Snowballs (not included in final score))

Aug 7th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace Snowballs
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int snowballs = int.Parse(Console.ReadLine());
  11.             BigInteger snowballValue = 0;
  12.             int bestSnow = 0;
  13.             int bestTime = 0;
  14.             int bestQuality = 0;
  15.  
  16.             for (int i = 0; i < snowballs; i++)
  17.             {
  18.                 int snowballSnow = int.Parse(Console.ReadLine());
  19.                 int snowballTime = int.Parse(Console.ReadLine());
  20.                 int snowballQuality = int.Parse(Console.ReadLine());
  21.                
  22.                 BigInteger value = BigInteger.Pow(snowballSnow / snowballTime, snowballQuality);              
  23.                
  24.                 if (value >= snowballValue)
  25.                 {
  26.                     snowballValue = value;
  27.                     bestSnow = snowballSnow;
  28.                     bestTime = snowballTime;
  29.                     bestQuality = snowballQuality;
  30.                 }
  31.             }
  32.             Console.WriteLine($"{bestSnow} : {bestTime} = {snowballValue} ({bestQuality})");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement