Advertisement
mswi12

sleepingCatTom

Sep 1st, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class sleepingCatTom {
  3.     public static void main(String []args){
  4.         Scanner scanner = new Scanner(System.in);
  5.         int holidays = Integer.parseInt(scanner.nextLine());
  6.         int workingDays = 365 - holidays;
  7.         int holidaysMin = holidays * 127;
  8.         int workingDaysMin = workingDays * 63;
  9.         int allMin = holidaysMin + workingDaysMin;
  10.         int lessPlayH = (30000 - allMin)  / 60;
  11.         int lessPlayM = (30000 - allMin)  % 60;
  12.         int morePlayH = (allMin - 30000) /60;
  13.         int morePlayM = (allMin - 30000) % 60;
  14.             if (allMin < 30000) {
  15.                 System.out.println("Tom sleeps well");
  16.                 System.out.printf("%d hours and %d minutes less for play", lessPlayH, lessPlayM);
  17.                
  18.             } else {
  19.                
  20.                 System.out.println("Tom will run away");
  21.                 System.out.printf("%d hours and %d minutes more for play", morePlayH, morePlayM);
  22.                
  23.             }
  24.        
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement