Advertisement
nbzhk

P02SleepyTomCat

Jan 16th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package Extra;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02SleepyTomCat {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int daysOff = Integer.parseInt(scanner.nextLine());
  10.  
  11.         int daysOffInMinutes = daysOff * 127;
  12.         int workDaysInMinutes =  (365 - daysOff) * 63;
  13.         int minMore = Math.abs(30000 - (daysOffInMinutes + workDaysInMinutes));
  14.         int hours = minMore / 60;
  15.         int minutes = minMore % 60;
  16.  
  17.  
  18.         if (daysOffInMinutes + workDaysInMinutes > 30000) {
  19.             System.out.printf("Tom will run away%n%d hours and %02d minutes more for play", hours, minutes);
  20.         }else {
  21.             System.out.printf("Tom sleeps well%n%d hours and %02d minutes less for play",hours,minutes);
  22.         }
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement