Advertisement
Guest User

Untitled

a guest
Jan 12th, 2018
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _01.Problem
  9. {
  10.  
  11. class Program
  12. {
  13.  
  14. static void Main(string[] args)
  15. {
  16. int numberOfSnowballs = int.Parse(Console.ReadLine());
  17.  
  18. List<Tuple<double, double, double, double>> listOfValues = new List<Tuple<double, double, double, double>>();
  19.  
  20. for (int i = 0; i < numberOfSnowballs; i++)
  21. {
  22. double snowballSnow = double.Parse(Console.ReadLine());
  23. double snowballTime = double.Parse(Console.ReadLine());
  24. double snowballQuality = double.Parse(Console.ReadLine());
  25.  
  26. double numberOfThrows = snowballSnow / snowballTime;
  27.  
  28. double snowballValue = Math.Pow(numberOfThrows, snowballQuality);
  29.  
  30. var tuple4Parts = new Tuple<double, double, double, double>
  31. (snowballSnow, snowballTime, snowballValue, snowballQuality);
  32.  
  33. listOfValues.Add(tuple4Parts);
  34. }
  35.  
  36. var highestSnowBallValue = listOfValues.OrderByDescending(x => x.Item3).First();
  37. Console.WriteLine($"{highestSnowBallValue.Item1} : {highestSnowBallValue.Item2} = {highestSnowBallValue.Item3} ({highestSnowBallValue.Item4})");
  38.  
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement