Advertisement
Spocoman

08. Beer Kegs

Oct 18th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine()),
  7.             height = 0;
  8.         String model, bigModel = "";
  9.         double radius, sum, biggest = 0;
  10.  
  11.         for (int i = 0; i < n; i++) {
  12.             model = scanner.nextLine();
  13.             radius = Double.parseDouble(scanner.nextLine());
  14.             height = Integer.parseInt(scanner.nextLine());
  15.             sum = Math.PI * radius * radius * height;
  16.             if (sum > biggest) {
  17.                 biggest = sum;
  18.                 bigModel = model;
  19.             }
  20.         }
  21.        
  22.         System.out.println(bigModel);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement