Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.  
  3.     let firstEmployee = input.shift();
  4.     let secondEmployee = input.shift();
  5.     let thirdEmployee = input.shift();
  6.     let totalPeople = input.shift();
  7.  
  8.     let totalPeoplePerHour = firstEmployee + secondEmployee + thirdEmployee;
  9.  
  10.      let totalHour = Math.ceil(totalPeople / totalPeoplePerHour);
  11.  
  12.    
  13.      if (totalHour > 3) {
  14.          totalHour += Math.floor(totalHour / 3)
  15.      }
  16.    
  17.    
  18.     console.log(`Time needed: ${totalHour}h.`);
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement