Skip to content
Snippets Groups Projects
Commit 0dc08006 authored by Florian Burgener's avatar Florian Burgener
Browse files

Ex 3

parent f92e4afa
Branches
No related tags found
No related merge requests found
......@@ -16,29 +16,35 @@
#include <stdlib.h>
#include <string.h>
int main() {
// int32_t values_length = 5;
// double values[values_length];
int32_t count_posibilities(int32_t remaining_money, int32_t available_money) {
if (available_money == 1) {
return 1;
}
// for (int32_t i = 0; i < values_length; i += 1) {
// double value;
// scanf("%lf", &value);
// values[i] = value;
// }
int32_t next_available_money = available_money;
// int32_t values_length = 5;
// int32_t values[values_length];
if (next_available_money == 10) {
next_available_money = 2;
} else if (next_available_money == 2) {
next_available_money = 1;
}
// for (int32_t i = 0; i < values_length; i += 1) {
// int32_t value;
// scanf("%d", &value);
// values[i] = value;
// }
int32_t count = 0;
int32_t i = 1;
// char a[100];
// int32_t b;
// scanf("%s %d", a, &b);
// printf("%s %d\n", a, b);
while (remaining_money >= i * available_money) {
count += count_posibilities(remaining_money - available_money * i, next_available_money);
i += 1;
}
count += count_posibilities(remaining_money, next_available_money);
return count;
}
int main() {
int32_t input;
scanf("%d", &input);
int32_t count = count_posibilities(input, 10);
printf("\n%d\n", count);
return EXIT_SUCCESS;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment