Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.lang.Math;
- public class SleepyTomCat {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int holidays = Integer.parseInt(scanner.nextLine());
- int work = 365 - holidays;
- int totalplaydays = work * 63 + holidays * 127;
- int totalMins = 30000 - totalplaydays;
- int hours = Math.abs(totalMins / 60);
- int mins = Math.abs(totalMins % 60);
- if (30000 < totalplaydays)
- {
- System.out.println("Tom will run away");
- System.out.printf(" %d hours and %d minutes more for play", hours, mins);
- }
- else
- {
- System.out.println("Tom sleeps well");
- System.out.printf(" %d hours and %d minutes less for play", hours, mins);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement