Advertisement
Ivakis

Sleepy Tom cat

Sep 28th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int holidays = Integer.parseInt(scanner.nextLine());
  8.  
  9. int holidaysPlay = holidays * 127;
  10. int workdaysPlay = (365 - holidays) * 63;
  11.  
  12. int totalPlayInMinutes = holidaysPlay + workdaysPlay;
  13.  
  14. if(30000 > totalPlayInMinutes){
  15. int minutesAfterPlay = 30000 - totalPlayInMinutes;
  16. int hours = minutesAfterPlay / 60;
  17. int minutes = minutesAfterPlay % 60;
  18. System.out.printf("Tom sleeps well\n" +
  19. "%d hours and %d minutes less for play\n", hours, minutes);
  20. }else{
  21. int minutesAfterPlay = totalPlayInMinutes - 30000;
  22. int hours = minutesAfterPlay / 60;
  23. int minutes = minutesAfterPlay % 60;
  24. System.out.printf("Tom will run away\n" +
  25. "%d hours and %d minutes more for play\n", hours, minutes);
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement