01. Pipes In Pool
здравейте, програмата ми работи без грешка а в джъдж ми дава 30 точки
Може ли някой да ми обясни защо?
function pipesInPool(input){
let volume = Number(input[0]);
let debitOne = Number(input[1]);
let debitTwo = Number(input[2]);
let hours = Number(input[3]);
let totalDebitOne = debitOne * hours;
let totalDebitTwo = debitTwo * hours;
let totalDebits = totalDebitOne + totalDebitTwo;
let diff = Math.abs(volume - totalDebits);
if(totalDebits <= volume){
console.log(`The pool is
${(totalDebits * 0.1).toFixed(2)}% full.
Pipe 1: ${((totalDebitOne / totalDebits) * 100).toFixed(2)}%
Pipe 2: ${((totalDebitTwo / totalDebits) * 100).toFixed(2)}%.`)
}
else {
console.log(`For ${hours}
hours the pool overflows with ${diff.toFixed(2)} liters.`)
}
}