遞迴_找錢

 avatar
user_3763047219
c_cpp
2 years ago
402 B
1
Indexable
Never
extern int moneyPerm(int K);


int moneyPerm(int K) {
	int count = 0;
	for (int i = 0; i <= K / 10;i++) {
		for (int j = 0; j <= K/5; j++) {
			for (int m = 0; m <= K; m++) {
				if (K == i * 10 + j * 5 + m * 1) {
					count++;
				}
			}
		}
	}
	return count;
}

#include <stdio.h>


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