Advertisement
Liliana797979

vqrno reshenie na sleepy tom

Dec 10th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sleeppyTom(arg1) {
  2.     let holidays = Number(arg1);
  3.     let workingDays = 365 - holidays;
  4.     let totalPlayMinutes = workingDays * 63 + holidays * 127;
  5.     let difference = Math.abs(totalPlayMinutes - 30000);
  6.     let hours = difference / 60;
  7.     let minutes = difference % 60;
  8.  
  9.     if (totalPlayMinutes > 30000) {
  10.         console.log(`Tom will run away`);
  11.         console.log(`${Math.floor(hours)} hours and ${Math.floor(minutes)} minutes more play`);
  12.     } else {
  13.         console.log(`Tom sleeps well`);
  14.         console.log(`${Math.floor(hours)} hours and ${Math.floor(minutes)} minutes less play`);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement