SHARE
TWEET

Snowballs

elvirynwa Feb 1st, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class SnowBalls {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int numberOfSnowballs = Integer.parseInt(scanner.nextLine());
  8.  
  9.         long snowballValue = 0;
  10.         long highestValue = 0;
  11.  
  12.         int snowballSnowOutput = 0;
  13.         int snowballTimeOutput = 0;
  14.         int snowballQualityOutput = 0;
  15.         for (int i = 1; i <= numberOfSnowballs; i++) {
  16.             int snowballSnow = Integer.parseInt(scanner.nextLine());
  17.             int snowballTime = Integer.parseInt(scanner.nextLine());
  18.             int snowballQuality = Integer.parseInt(scanner.nextLine());
  19.  
  20.  
  21.             snowballValue = (long) Math.pow((snowballSnow / snowballTime), snowballQuality);
  22.  
  23.             if (snowballValue > highestValue){
  24.                 highestValue = snowballValue;
  25.                 snowballSnowOutput = snowballSnow;
  26.                 snowballTimeOutput = snowballTime;
  27.                 snowballQualityOutput = snowballQuality;
  28.             }
  29.         }
  30.         System.out.printf("%d : %d = %d (%d)",snowballSnowOutput,snowballTimeOutput,highestValue,snowballQualityOutput);
  31.     }
  32. }
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