Advertisement
desislava_topuzakova

11.Snowballs

May 27th, 2022
931
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Test;
  2.  
  3.  
  4. import java.util.*;
  5.  
  6. public class demo {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         int n = Integer.parseInt(scanner.nextLine());
  10.         double maxValue = Double.MIN_VALUE;
  11.         int snowballSnowBiggest = 0;
  12.         int snowballTTimeBiggest = 0;
  13.         int snowballQualityBiggest = 0;
  14.  
  15.  
  16.         for (int snowBall = 1; snowBall <= n; snowBall++) {
  17.             int snowBallSnow = Integer.parseInt(scanner.nextLine());
  18.             int snowBallTime = Integer.parseInt(scanner.nextLine());
  19.             int snowBallQuality = Integer.parseInt(scanner.nextLine());
  20.             double snowBallValue = Math.pow(snowBallSnow / snowBallTime,snowBallQuality);
  21.  
  22.             if (snowBallValue > maxValue){
  23.                 maxValue = snowBallValue;
  24.                 snowballSnowBiggest = snowBallSnow;
  25.                 snowballTTimeBiggest = snowBallTime;
  26.                 snowballQualityBiggest = snowBallQuality;
  27.             }
  28.  
  29.  
  30.  
  31.         }
  32.         System.out.printf("%d : %d = %.0f (%d) ",snowballSnowBiggest, snowballTTimeBiggest, maxValue ,snowballQualityBiggest );
  33.  
  34.  
  35.     }
  36. }
Advertisement
RAW Paste Data Copied
Advertisement