168. 找錢的排列種類
user_6817964
c_cpp
2 years ago
350 B
6
Indexable
extern int moneyPerm(int K); int moneyPerm(int K) { if (K >= 10) { return moneyPerm(K - 1) + moneyPerm(K - 5) + moneyPerm(K - 10); } else if (K >= 5) { return moneyPerm(K - 1) + moneyPerm(K - 5); } else { return 1; } } int main() { int money; scanf("%d", &money); printf("%d", moneyPerm(money)); return 0; }
Editor is loading...