Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- int height = Integer.parseInt(scanner.nextLine());
- int width = Integer.parseInt(scanner.nextLine());
- int skipPercent = Integer.parseInt(scanner.nextLine());
- double totalSpace = height * width * 4;
- totalSpace = Math.ceil(totalSpace - (totalSpace * skipPercent) / 100.0);
- while (true) {
- String input = scanner.nextLine();
- if (input.equals("Tired!")) {
- break;
- } else {
- totalSpace -= Integer.parseInt(input);
- if (totalSpace <= 0) {
- break;
- }
- }
- }
- if (totalSpace > 0) {
- System.out.printf("%.0f quadratic m left.",totalSpace);
- }
- if (totalSpace < 0) {
- System.out.printf("All walls are painted and you have %.0f l paint left!", Math.abs(totalSpace));
- }
- if (totalSpace == 0) {
- System.out.print("All walls are painted! Great job, Pesho!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement