Advertisement
Guest User

Untitled

a guest
Sep 27th, 2019
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         Scanner in = new Scanner(System.in);
  8.  
  9.         int N = Integer.parseInt(in.nextLine());
  10.        
  11.         double highestSnowballValue = -1;
  12.         double highestSnowballSnow = 0;
  13.         double highestSnowballTime = 0;
  14.         double highestSnowballQuality = 0;
  15.        
  16.         for (int i = 0; i < N; i++) {
  17.            
  18.             double snowballSnow = Integer.parseInt(in.nextLine());
  19.             double snowballTime = Integer.parseInt(in.nextLine());
  20.             double snowballQuality = Integer.parseInt(in.nextLine());
  21.            
  22.             double snowballValue = Math.pow((snowballSnow / snowballTime), snowballQuality);
  23.            
  24.             if (snowballValue > highestSnowballValue) {
  25.                
  26.                 highestSnowballValue = snowballValue;
  27.                 highestSnowballSnow = snowballSnow;
  28.                 highestSnowballTime = snowballTime;
  29.                 highestSnowballQuality = snowballQuality;
  30.                
  31.             }
  32.         }
  33.        
  34.         if ((highestSnowballValue - Math.floor(highestSnowballValue)) > 0) {
  35.             System.out.printf("%d : %d = %.2f (%d)%n",
  36.                     (int) highestSnowballSnow,
  37.                     (int) highestSnowballTime,
  38.                     highestSnowballValue,
  39.                     (int) highestSnowballQuality);
  40.         } else {
  41.             System.out.printf("%d : %d = %d (%d)%n",
  42.                     (int) highestSnowballSnow,
  43.                     (int) highestSnowballTime,
  44.                     (int) highestSnowballValue,
  45.                     (int) highestSnowballQuality);
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement