Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Program {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int wines = 300;
- int beers = 200;
- int wD = 0;
- int wO = 0;
- int bD = 0;
- int bO = 0;
- while (true) {
- String[] input = scan.nextLine().split(": ");
- if (input[0].equalsIgnoreCase("end")) {
- break;
- }
- if (input[0].equals("Beers")) {
- int q = Integer.parseInt(input[1]);
- beers += q;
- if (q > 0) {
- bD++;
- } else if (q < 0) {
- bO++;
- }
- }else if (input[0].equals("Wines")) {
- int q = Integer.parseInt(input[1]);
- wines += q;
- if (q > 0) {
- wD++;
- } else if (q < 0) {
- wO++;
- }
- }
- }
- System.out.println("Beers: " + beers);
- System.out.println("Beers orders: " + bO);
- System.out.println("Beers deliveries: " + bD);
- System.out.println("Wines: " + wines);
- System.out.println("Wines orders: " + wO);
- System.out.println("Wines deliveries: " + wD);
- }
- }
- import java.util.ArrayList;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String[]input = scan.nextLine().split(",");
- double r1 = Double.parseDouble(input[0]);
- double h1 = Double.parseDouble(input[1]);
- double r2 = Double.parseDouble(input[2]);
- double h2 = Double.parseDouble(input[3]);
- double v1 = 3.14159265359* (r1*r1) *h1/1000;
- double v2 = 3.14159265359* (r2*r2) *h2/1000;
- System.out.printf("%.2f",Math.max(v1,v2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement