Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ThreeBrothers3 {
- public static void main(String[] agrs) {
- 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 fishingTime = Double.parseDouble(scanner.nextLine());
- double cleaningTime = 1 / (1 / A + 1 / B + 1 / C);
- double rest = (cleaningTime * 0.15) + cleaningTime;
- double allCleaningTime = fishingTime - rest;
- if (allCleaningTime > 0) {
- System.out.printf("Cleaning time: %.2f %n", rest);
- System.out.printf("Yes, there is a surprise - time left -> %d hours.", (int) (Math.floor(fishingTime - rest)));
- } else {
- System.out.printf("Cleaning time: %.2f %n", rest);
- System.out.printf("No, there isn't a surprise - shortage of time -> %d hours.", (int) (Math.ceil(rest - fishingTime)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement