Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.util.Scanner;
- import static java.lang.System.*;
- public class Tomcat {
- public static void main(String[] args) {
- Scanner sc = new Scanner(in);
- int dayOff = Integer.parseInt(sc.nextLine());
- int work = 365 - dayOff;
- int workplay = work * 63;
- int offdayplay = dayOff * 127;
- int sumplay = workplay + offdayplay;
- int norm = 30000;
- int diff = (norm - sumplay);
- int hours = Math.abs(diff/60);
- int minutes = Math.abs(diff%60);
- if (sumplay > norm) {
- System.out.println("Tom will run away");
- System.out.printf("%d hours and %d minutes more for play", hours, minutes);
- }else{
- if (sumplay <= norm){
- System.out.println("Tom sleeps well");
- System.out.printf("%d hours and %d minutes less for play", hours, minutes);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment