Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exercise1002;
- import java.util.Scanner;
- public class Exercise1002 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int snowballCount = Integer.parseInt(scanner.nextLine());
- double maxValue = 0.0;
- int bestSnow = 0;
- int bestTime =0;
- int bestQuality=0;
- while ( snowballCount -->0){
- int snowballSnow = Integer.parseInt(scanner.nextLine());
- int snowballTime = Integer.parseInt(scanner.nextLine());
- int snowballQuality = Integer.parseInt(scanner.nextLine());
- double snowballValue = Math.pow((snowballSnow / snowballTime) , snowballQuality);
- if (snowballValue > maxValue){
- maxValue= snowballValue;
- bestSnow=snowballSnow;
- bestTime=snowballTime;
- bestQuality=snowballQuality;
- }
- }
- System.out.printf("%d : %d = %.0f (%d)",bestSnow,bestTime,maxValue,bestQuality);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement