Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sleepyTomCat(input) {
- let day = parseInt(input[0]);
- let work = (365 - day) * 63;
- let holiday = day * 127;
- let sum = work + holiday;
- let minutes = 0;
- if (sum >= 30000) {
- minutes = sum - 30000;
- console.log("Tom will run away");
- if (minutes % 60 < 10) {
- console.log(`${Math.floor(minutes/60)} hours and 0${minutes % 60} minutes more for play`);
- } else {
- console.log(`${Math.floor(minutes/60)} hours and ${minutes % 60} minutes more for play`);
- }
- } else {
- minutes = 30000 - sum;
- console.log("Tom sleeps well");
- if (minutes % 60 < 10 && minutes == 0) {
- console.log(`${Math.floor(minutes/60)} hours and 0${minutes % 60} minutes less for play`);
- } else {
- console.log(`${Math.floor(minutes/60)} hours and ${minutes % 60} minutes less for play`);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement