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