danisun18

Snowballs

Jul 16th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Snowballs {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int n = Integer.parseInt(scan.nextLine());
  7.         long snowballValue = 0;
  8.         int snow = 0;
  9.         int time = 0;
  10.         int quality = 0;
  11.         for (int i = 0; i < n; i++) {
  12.             int snowballSnow = Integer.parseInt(scan.nextLine());
  13.             int snowballTime = Integer.parseInt(scan.nextLine());
  14.             int snowballQuality = Integer.parseInt(scan.nextLine());
  15.             long divide = (long) Math.pow(snowballSnow / snowballTime, snowballQuality);
  16.             if (divide >= snowballValue) {
  17.                 snowballValue = divide;
  18.                 snow = snowballSnow;
  19.                 time = snowballTime;
  20.                 quality = snowballQuality;
  21.             }
  22.         }
  23.         System.out.printf("%d : %d = %d (%d)%n", snow, time, snowballValue, quality);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment