SHARE
TWEET

Untitled

a guest May 26th, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Exercise1002;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Exercise1002 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         int snowballCount = Integer.parseInt(scanner.nextLine());
  11.  
  12.         double maxValue = 0.0;
  13.         int bestSnow = 0;
  14.         int bestTime =0;
  15.         int bestQuality=0;
  16.  
  17.         while ( snowballCount -->0){
  18.  
  19.             int snowballSnow = Integer.parseInt(scanner.nextLine());
  20.             int snowballTime = Integer.parseInt(scanner.nextLine());
  21.             int snowballQuality = Integer.parseInt(scanner.nextLine());
  22.  
  23.            double snowballValue = Math.pow((snowballSnow / snowballTime) , snowballQuality);
  24.  
  25.            if (snowballValue > maxValue){
  26.                maxValue= snowballValue;
  27.                bestSnow=snowballSnow;
  28.                bestTime=snowballTime;
  29.                bestQuality=snowballQuality;
  30.  
  31.  
  32.            }
  33.  
  34.  
  35.         }
  36.  
  37.         System.out.printf("%d : %d = %.0f (%d)",bestSnow,bestTime,maxValue,bestQuality);
  38.  
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top