bacco

Sleeping Cut

Mar 15th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function read([arg1]){
  2.  
  3.     var daysFree = Number(arg1);
  4.  
  5.     var minFreeGames = daysFree * 127;
  6.     var minWorkGames = (365 - daysFree)* 63;
  7.     var diff = 30000 - (minWorkGames + minFreeGames);
  8.  
  9.     var hours = parseInt(diff / 60);
  10.     var mins  = diff % 60;
  11.  
  12.     if( diff >= 0){
  13.          console.log('Tom sleeps well ');
  14.          console.log(`${hours} hours and ${mins} minutes less for play`);
  15.     }else{
  16.       console.log('Tom will run away');
  17.       console.log(`${Math.abs(hours)} hours and ${Math.abs(mins)} minutes more for play`);
  18.       }
  19. }
  20.  
  21. read(["150" ]);
Advertisement
Add Comment
Please, Sign In to add comment