Advertisement
Spocoman

11.Snowballs

Oct 18th, 2024
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int snowballs = Integer.parseInt(scanner.nextLine()),
  7.             snowballSnow, snowballTime, snowballQuality;
  8.         double value, highestValue = 0;
  9.         String output = "";
  10.        
  11.         for (int i = 0; i < snowballs; i++) {
  12.             snowballSnow = Integer.parseInt(scanner.nextLine());
  13.             snowballTime = Integer.parseInt(scanner.nextLine());
  14.             snowballQuality = Integer.parseInt(scanner.nextLine());
  15.  
  16.             value = Math.pow((double)(snowballSnow) / (double)(snowballTime), (double)(snowballQuality));
  17.  
  18.             if (value > highestValue) {
  19.                 highestValue = value;
  20.                 output = String.format("%d : %d = %.0f (%d)", snowballSnow, snowballTime, value, snowballQuality);
  21.             }
  22.         }
  23.            
  24.         System.out.println(output);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement