第26646题 单选题
Python贪心算法找零程序横线填空

一名收银员,给顾客找零,找零的目标是给出确定金额的同时,使用尽可能少的硬币。有不同面额的硬币:1分,5分,10分,25分。如果需要给顾客准确的零钱,同时使用最少的硬币,下列程序中横线应该填写( )。

def coin_change(amount, coins):
    result = []
    for coin in sorted(coins, reverse=True):
        while amount >= coin:
            ___________________
            result.append(coin)
    return result

coins = [1, 5, 10, 25]
amount = 63
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析