В
Size: a a a
В
В
В
В
DE
В
В
В
В
В
DE
DE
DE
const m = [500, 200, 100, 50, 20, 10]
const calculate = (a) => {
if (a < Math.min(...m) || !m.some((v) => a % v === 0)) {
return -1
}
let i = 0
let count = 0
while (a > 0) {
while (a >= m[i]) {
a = a - m[i]
count += 1
}
i += 1
}
return count
}
S
const m = [500, 200, 100, 50, 20, 10]
const calculate = (a) => {
if (a < Math.min(...m) || !m.some((v) => a % v === 0)) {
return -1
}
let i = 0
let count = 0
while (a > 0) {
while (a >= m[i]) {
a = a - m[i]
count += 1
}
i += 1
}
return count
}
В
const m = [500, 200, 100, 50, 20, 10]
const calculate = (a) => {
if (a < Math.min(...m) || !m.some((v) => a % v === 0)) {
return -1
}
let i = 0
let count = 0
while (a > 0) {
while (a >= m[i]) {
a = a - m[i]
count += 1
}
i += 1
}
return count
}
В
const m = [500, 200, 100, 50, 20, 10]
const calculate = (a) => {
if (a < Math.min(...m) || !m.some((v) => a % v === 0)) {
return -1
}
let i = 0
let count = 0
while (a > 0) {
while (a >= m[i]) {
a = a - m[i]
count += 1
}
i += 1
}
return count
}
В
DE
DE