desislava_topuzakova

11.Snowballs

Jan 23rd, 2021
904
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package DataTypes;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Snowballs_11 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int n = Integer.parseInt(scanner.nextLine());
  10.         int maxSnowballSnow = Integer.MIN_VALUE;
  11.         int maxSnowballTime = Integer.MIN_VALUE;
  12.         int maxSnowballQuality = Integer.MIN_VALUE;
  13.         double maxSnowballValue  = Double.MIN_VALUE;
  14.         for (int i = 0; i < n; i++) {
  15.             int snowballSnow = Integer.parseInt(scanner.nextLine());
  16.             int snowballTime = Integer.parseInt(scanner.nextLine());
  17.             int snowballQuality = Integer.parseInt(scanner.nextLine());
  18.             //
  19.             double snowballValue = Math.pow((snowballSnow / snowballTime), snowballQuality);
  20.  
  21.             if(maxSnowballValue < snowballValue) {
  22.                 maxSnowballValue = snowballValue;
  23.                 maxSnowballSnow = snowballSnow;
  24.                 maxSnowballTime = snowballTime;
  25.                 maxSnowballQuality = snowballQuality;
  26.             }
  27.         }
  28.  
  29.         System.out.printf("%d : %d = %.0f (%d)", maxSnowballSnow, maxSnowballTime, maxSnowballValue, maxSnowballQuality);
  30.     }
  31. }
  32.  
RAW Paste Data