Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int daysOff = Integer.parseInt(scanner.nextLine());
- int daysAtWork = 365 - daysOff;
- int playMinutes = (daysOff * 127) + (daysAtWork * 63);
- double hours = 0;
- double minutes = 0;
- if (playMinutes > 30000) {
- int diff = playMinutes - 30000;
- if (diff > 59) {
- hours = diff / 60;
- minutes = diff - (hours * 60);
- }
- System.out.println("Tom will run away");
- System.out.printf("%.0f hours and %.0f minutes more for play", hours , minutes);
- } else if (playMinutes < 30000) {
- int diff = playMinutes - 30000;
- if (diff > 59) {
- hours = diff / 60;
- minutes = diff - (hours * 60);
- {
- System.out.println("Tom sleeps well");
- System.out.printf("%.0f hours and %.0f minutes less for play", hours , minutes);
- }
- } else {
- System.out.println("Tom will run away");
- System.out.printf("%.0f hours and %.0f minutes more for play", hours , minutes);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement