Advertisement
NelIfandieva

Snowballs_Pr01_ExamJan2018

Feb 27th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Globalization;
  6.  
  7. namespace Feb26_2018
  8. {
  9.     class MainClass
  10.     {
  11.         /* */
  12.  
  13.         public static void Main()
  14.         {
  15.             //int k = int.Parse(Console.ReadLine());
  16.             //var input = Console.ReadLine()
  17.             //                   .Split()
  18.             //                   .Select(double.Parse)
  19.             //                   .ToList();
  20.  
  21.             //var firstK = input.Take(k);
  22.             //var asd = input.ToArray().Reverse();
  23.             //Console.WriteLine(asd);
  24.  
  25.  
  26.             int snwbNum = int.Parse(Console.ReadLine());
  27.             int[] snwbData = new int[snwbNum * 3];
  28.             int snwbPower = 0;
  29.             int maxSnwbPower = Int32.MinValue;
  30.             int bestIndexOne = 0;
  31.             int bestIndexTwo = 0;
  32.             int bestIndexThree = 0;
  33.             for (int a = 0; a < snwbData.Length; a++)
  34.             {
  35.                 snwbData[a] = int.Parse(Console.ReadLine());
  36.             }
  37.             for (int i = 0; i < snwbData.Length; i++)
  38.             {
  39.                 if ((i + 1) % 3 == 0)
  40.                 {
  41.                     snwbPower = (int)Math.Pow((snwbData[i - 2] / snwbData[i - 1]), snwbData[i]);
  42.                     if (snwbPower > maxSnwbPower)
  43.                     {
  44.                         maxSnwbPower = snwbPower;
  45.                         bestIndexOne = snwbData[i - 2];
  46.                         bestIndexTwo = snwbData[i - 1];
  47.                         bestIndexThree = snwbData[i];
  48.                     }
  49.                 }
  50.             }
  51.  
  52.             Console.Write($"{bestIndexOne} : {bestIndexTwo} = {maxSnwbPower} ({bestIndexThree})");
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement