Lyutov02

SleepyTomCat

Nov 30th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SleepyTomCat {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner sc = new Scanner(System.in);
  7.  
  8.         int holidays = Integer.parseInt(sc.nextLine());
  9.         int workingDays = 365 - holidays;
  10.         int totalPlayMinutes = workingDays * 63 + holidays * 127;
  11.  
  12.         double difference = Math.abs(totalPlayMinutes - 30000);
  13.         double hours = difference / 60;
  14.         double minutes = difference % 60;
  15.  
  16.         if (totalPlayMinutes > 30000){
  17.             System.out.println("Tom will run away");
  18.             System.out.printf("%.0f hours and %.0f minutes more for play", Math.floor(hours), Math.floor(minutes));
  19.         } else {
  20.             System.out.println("Tom sleeps well");
  21.             System.out.printf("%.0f hours and %.0f minutes less for play", Math.floor(hours), Math.floor(minutes));
  22.         }
  23.  
  24.     }
  25. }
Add Comment
Please, Sign In to add comment