Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function skeleton(input) {
- let minutes = Number(input.shift());
- let seconds = Number(input.shift());
- let control = minutes * 60 + seconds;
- let lengthInMeters = Number(input.shift());
- let secondsFor100Meters = Number(input.shift());
- let time = lengthInMeters / 100 * secondsFor100Meters - lengthInMeters / 120 * 2.5;
- if (time <= control) {
- console.log(`Marin Bangiev won an Olympic quota!\nHis time is ${time.toFixed(3)}.`);
- } else {
- console.log(`No, Marin failed! He was ${(time - control).toFixed(3)} second slower.`);
- }
- }
- Tарикатско решение:)
- function skeleton(input) {
- let control = parseInt(input[0]) * 60 + parseInt(input[1]);
- let time = parseFloat(input[2]) / 100 * parseFloat(input[3]) - parseFloat(input[2]) / 120 * 2.5;
- console.log( time <= control ? `Marin Bangiev won an Olympic quota!\nHis time is ${time.toFixed(3)}.`
- : `No, Marin failed! He was ${(time - control).toFixed(3)} second slower.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement