Advertisement
yocalee

Snowballs

Jan 28th, 2020
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. package com.company;
  2.  
  3.  
  4.         import java.util.Scanner;
  5.  
  6. public class Jedi {
  7.     public static void main(String[] args) {
  8.         Scanner scanner=new Scanner(System.in);
  9.  
  10.  
  11.         byte n= Byte.parseByte(scanner.nextLine());
  12.         int highestSnowballValue=Integer.MIN_VALUE;
  13.  
  14.         int snowballQuality = 0;
  15.         int snow=0;
  16.         int time=0;
  17.         for (int i = 0; i <n ; i++) {
  18.             short snowballSnow= Short.parseShort(scanner.nextLine());
  19.             short snowballTime= Short.parseShort(scanner.nextLine());
  20.             byte snowballlQuality= Byte.parseByte(scanner.nextLine());
  21.  
  22.             int snowballValue=(int) Math.pow(snowballSnow/snowballTime, snowballlQuality);
  23.             if (snowballValue>=highestSnowballValue){
  24.                 highestSnowballValue=snowballValue;
  25.                 snowballQuality=snowballlQuality;
  26.                 snow=snowballSnow;
  27.                 time=snowballTime;
  28.             }
  29.         }
  30.         System.out.printf("%d : %d = %d (%d)", snow, time, highestSnowballValue, snowballQuality);
  31.  
  32.  
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement