Advertisement
Spocoman

Renovation

Sep 9th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int x = Integer.parseInt(scanner.nextLine()),
  7.                 y = Integer.parseInt(scanner.nextLine()),
  8.                 nonPaint = Integer.parseInt(scanner.nextLine());
  9.         double neededPaint = 1.0 * x * y * 4 * (100.0 - nonPaint) / 100;
  10.  
  11.         String command;
  12.         while (!(command = scanner.nextLine()).equals("Tired!")) {
  13.             neededPaint -= Integer.parseInt(command);
  14.             if (neededPaint <= 0) {
  15.                 break;
  16.             }
  17.         }
  18.  
  19.         if (neededPaint > 0) {
  20.             System.out.println((int) neededPaint + " quadratic m left.");
  21.         } else if (neededPaint == 0) {
  22.             System.out.println("All walls are painted! Great job, Pesho!");
  23.         } else {
  24.             System.out.println("All walls are painted and you have " + (int) Math.abs(neededPaint) + " l paint left!");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement