Advertisement
Ivakis

Поспаливата котка Том

Aug 12th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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 holidaysInMin = holidays * 127;
  10.  
  11. int workdaysMin = (365 - holidays) * 63;
  12.  
  13. int totalMinutes = holidaysInMin + workdaysMin;
  14.  
  15. if (totalMinutes < 30000){
  16. int hours = (30000 - totalMinutes) / 60;
  17. int min = (30000 - totalMinutes) % 60;
  18.  
  19. System.out.printf("Tom sleeps well\n" +
  20. "%d hours and %d minutes less for play\n", hours, min);
  21. }else {
  22. int hours = (totalMinutes - 30000) / 60;
  23. int min = (totalMinutes - 30000) % 60;
  24.  
  25. System.out.printf("Tom will run away\n" +
  26. "%d hours and %d minutes more for play\n", hours, min);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement