Advertisement
Guest User

Untitled

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