Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Plochki {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double a = Double.parseDouble(scanner.nextLine());
- double b = Double.parseDouble(scanner.nextLine());
- double c = Double.parseDouble(scanner.nextLine());
- double d = Double.parseDouble(scanner.nextLine());
- double commonTimeForCleaning = 1 / (1/a + 1/b + 1/c);
- double commonTimeWithBreak = commonTimeForCleaning * 0.15 + commonTimeForCleaning;
- double timeLeft = Math.abs(d - commonTimeWithBreak);
- if (commonTimeWithBreak <= d) {
- System.out.printf("Cleaning time: %.2f%n", commonTimeWithBreak);
- System.out.printf("Yes, there is a surprise - time left -> %.0f hours.%n", Math.floor(timeLeft));
- } else {
- System.out.printf("Cleaning time: %.2f%n", commonTimeWithBreak);
- System.out.printf("No, there isn't a surprise - shortage of time -> %.0f hours.", Math.ceil(timeLeft));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement