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