Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BeerKegs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- String biggestModel = "";
- double volume = 0;
- for (int i = 0; i < n ; i++) {
- double prevVolume = volume;
- String model = scanner.nextLine();
- double radius = Double.parseDouble(scanner.nextLine());
- int height = Integer.parseInt(scanner.nextLine());
- volume = Math.PI * Math.pow(radius , 2) * height ;
- if (volume > prevVolume){
- biggestModel = model;
- }
- }
- System.out.println(biggestModel);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement