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