desislava_topuzakova

11.Snowballs

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