#GESP4292. [GESP]L5-202609-Q4292-J

[GESP]L5-202609-Q4292-J

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

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

{{ select(1) }}

  • 正确
  • 错误