Advertisement
Spocoman

Skeleton

Jan 7th, 2022
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function skeleton(input) {
  2.  
  3.     let minutes = Number(input.shift());
  4.     let seconds = Number(input.shift());
  5.     let control = minutes * 60 + seconds;
  6.     let lengthInMeters = Number(input.shift());
  7.     let secondsFor100Meters = Number(input.shift());
  8.     let time = lengthInMeters / 100 * secondsFor100Meters - lengthInMeters / 120 * 2.5;
  9.  
  10.     if (time <= control) {
  11.         console.log(`Marin Bangiev won an Olympic quota!\nHis time is ${time.toFixed(3)}.`);
  12.     } else {
  13.         console.log(`No, Marin failed! He was ${(time - control).toFixed(3)} second slower.`);
  14.     }
  15. }
  16.  
  17.  
  18. Tарикатско решение:)
  19.  
  20. function skeleton(input) {
  21.     let control = parseInt(input[0]) * 60 + parseInt(input[1]);
  22.     let time = parseFloat(input[2]) / 100 * parseFloat(input[3]) - parseFloat(input[2]) / 120 * 2.5;
  23.     console.log( time <= control ? `Marin Bangiev won an Olympic quota!\nHis time is ${time.toFixed(3)}.`
  24.         : `No, Marin failed! He was ${(time - control).toFixed(3)} second slower.`);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement