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