看板 b96902HW 關於我們 聯絡資訊
有一題是用10、5、1來湊成10有幾種方法 first try用的自訂函數寫法如下 int count(int target){ int total = 0; if(target == 0) return 1; if(target >= 10) total += count(target - 10); if(target >= 5) total += count(target - 5); if(target >= 1) total += count(target - 1); return total; } 但是會多算次數 後來助教有教怎麼改 我有點忘記了,有人還記得嗎? 懇請助教或強者解答~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.155.139.123