Advertisement
silvana1303

snow balls

May 25th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Numerics;
  5.  
  6. namespace exampreparation
  7. {
  8.     class exam
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int snowballs = int.Parse(Console.ReadLine());
  13.             int snow = 0;
  14.             int time = 0;
  15.             int quality = 0;
  16.  
  17.             int highest = 0;
  18.             double value2 = 0;
  19.  
  20.             for (int i = 0; i < snowballs; i++)
  21.             {
  22.                 int snowBall = int.Parse(Console.ReadLine());
  23.                 int timeBall = int.Parse(Console.ReadLine());
  24.                 int qualityBall = int.Parse(Console.ReadLine());
  25.                 value2 = Math.Pow((snowBall / timeBall), qualityBall);
  26.  
  27.                 if (value2 > highest)
  28.                 {
  29.                     highest = (int)value2;
  30.                     snow = snowBall;
  31.                     time = timeBall;
  32.                     quality = qualityBall;
  33.                 }
  34.  
  35.             }
  36.  
  37.             Console.WriteLine($"{snow} : {time} = {highest} ({quality})");
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement