Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pr11Snowballs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- byte numberOfSnowballs = Byte.parseByte(scanner.nextLine());
- double bestValue = 0;
- double bestSnowballSnow = 0;
- double bestSnowballTime = 0;
- double bestSnowballQuality = 0;
- for (int i = 0; i < numberOfSnowballs; i++) {
- double snowballSnow = Integer.parseInt(scanner.nextLine());
- double snowballTime = Integer.parseInt(scanner.nextLine());
- double snowballQuality = Integer.parseInt(scanner.nextLine());
- double snowballValue = Math.pow((snowballSnow / snowballTime), snowballQuality);
- if (snowballValue > bestValue) {
- bestValue = snowballValue;
- bestSnowballSnow = snowballSnow;
- bestSnowballTime = snowballTime;
- bestSnowballQuality = snowballQuality;
- }
- }
- System.out.println(String.format("%.0f : %.0f = %.0f (%.0f)",
- bestSnowballSnow, bestSnowballTime, bestValue, bestSnowballQuality));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement