Advertisement
mirozspace

SnowBall

Jan 31st, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Pr11Snowballs {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         byte numberOfSnowballs = Byte.parseByte(scanner.nextLine());
  7.         double bestValue = 0;
  8.         double bestSnowballSnow = 0;
  9.         double bestSnowballTime = 0;
  10.         double bestSnowballQuality = 0;
  11.  
  12.         for (int i = 0; i < numberOfSnowballs; i++) {
  13.             double snowballSnow = Integer.parseInt(scanner.nextLine());
  14.             double snowballTime = Integer.parseInt(scanner.nextLine());
  15.             double snowballQuality = Integer.parseInt(scanner.nextLine());
  16.             double snowballValue = Math.pow((snowballSnow / snowballTime), snowballQuality);
  17.             if (snowballValue > bestValue) {
  18.                 bestValue = snowballValue;
  19.                 bestSnowballSnow = snowballSnow;
  20.                 bestSnowballTime = snowballTime;
  21.                 bestSnowballQuality = snowballQuality;
  22.             }
  23.         }
  24.         System.out.println(String.format("%.0f : %.0f = %.0f (%.0f)",
  25.                 bestSnowballSnow, bestSnowballTime, bestValue, bestSnowballQuality));
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement