Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function threeBrothers(input) {
- let firstTime = Number(input[0]);
- let secondTime = Number(input[1]);
- let thirdTime = Number(input[2]);
- let fatherTime = Number(input[3]);
- let cleaningTime = 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15;
- console.log(`Cleaning time: ${cleaningTime.toFixed(2)}`);
- if (fatherTime > cleaningTime) {
- console.log(`Yes, there is a surprise - time left -> ${Math.floor(fatherTime - cleaningTime)} hours.`);
- } else {
- console.log(`No, there isn't a surprise - shortage of time -> ${Math.ceil(cleaningTime - fatherTime)} hours.`);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement