‹ 上一题 下一题 ›

g5-04622. GESP-5级-2026-09-判断-第09题 未做

1000 ms 256 MB 测试点 ? GESPGESP-52026-09判断客观题5级·贪心贪心

下面的贪心代码一定能对任意硬币面值集合 coins 求出 money 所需的最少硬币数。

int count = 0;
for (int coin : coins) { // coins 按面值从大到小排列
    count += money / coin;
    money %= coin;
}
未选择
输入
输出

            
答案