遞迴_找錢的排列組合

 avatar
user_3763047219
c_cpp
a year ago
376 B
3
Indexable
Never
extern int moneyPerm(int K);



int moneyPerm(int K) {
	if (K >= 10) {
		return moneyPerm(K - 10) + moneyPerm(K - 5) + moneyPerm(K - 1);
	}
	else if (K >= 5) {
		return  + moneyPerm(K - 5) + moneyPerm(K - 1);
	}
	else {
		return  1;
	}
}

#include <stdio.h>


int main() {
	int money;
	scanf("%d", &money);
	printf("%d", moneyPerm(money));
	return 0;
}