07. Time to Walk | Exercise: JavaScript Syntax and Operators | JS Core
Задача 07. Time to Walk - https://judge.softuni.bg/Contests/Practice/Index/1422#6
Някой дали е решавал въпросната задача? Защото ми дава 60/100, а си нямам на идея къде бъркам точно.
function TimeToWalk(arg1, arg2, arg3) {
let stepsNumber = Number(arg1);
let stepsMetersHr = Number(arg2);
let studentSpeed = Number(arg3);
let distanceMeters = stepsNumber * stepsMetersHr;
let speedMetersSec = studentSpeed / 3.6;
let time = distanceMeters / speedMetersSec;
let rest = Math.floor(distanceMeters / 500);
let timeMin = Math.floor(time / 60);
let timeSec = Math.round(time - (timeMin * 60));
let timeHr = Math.floor(time / 3600);
//console.log(distanceMeters);
//console.log(speedMetersSec);
//console.log(time);
//console.log(rest);
if (timeHr < 10) {
console.log(timeHr + "0:" + (timeMin + rest) + ":" + timeSec);
} else {
console.log(timeHr + ":" + (timeMin + rest) + ":" + timeSec);
}
}
//TimeToWalk(4000, 0.60, 5);
//TimeToWalk(2564, 0.70, 5.5);
//https://stackoverflow.com/questions/3733227/javascript-seconds-to-minutes-and-seconds