TZinovieva

Skeleton JS

Dec 6th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function skeleton(input) {
  2.     let minutes = Number(input[0]);
  3.     let seconds = Number(input[1]);
  4.     let length = Number(input[2]);
  5.     let secondsPer100M = Number(input[3]);
  6.  
  7.     let contrSeconds = minutes * 60 + seconds;
  8.     let timeForLength = length / 100 * secondsPer100M;
  9.  
  10.     let timeSlowing = length / 120 * 2.5;
  11.     let time = timeForLength - timeSlowing;
  12.  
  13.     if (time <= contrSeconds) {
  14.         console.log(`Marin Bangiev won an Olympic quota!`);
  15.         console.log(`His time is ${time.toFixed(3)}.`);
  16.     } else {
  17.         console.log(`No, Marin failed! He was ${Math.abs(contrSeconds - time).toFixed(3)} second slower.`);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment