Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package homework222;
- import java.util.Scanner;
- public class sleepycattom {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int pochivka = scan.nextInt();
- int rabotnidni = 365 - pochivka;
- int totalPlayMinutes = rabotnidni * 63 + pochivka * 127;
- double difference = Math.abs(30000 - totalPlayMinutes);
- double hours = difference / 60;
- double minutes = difference % 60;
- if(totalPlayMinutes > 30000) {
- System.out.println("Tom will run away");
- System.out.printf("%.0f hours and %.0f minutes more to play" , Math.floor(hours) ,Math.floor(minutes));
- }else {
- System.out.println("Tom sleeps well");
- System.out.printf("%.0f hours and %.0f minutes less to play" , Math.floor(hours),Math.floor(minutes));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement