Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "function.h"
- void showResult(int n)
- {
- int i;
- printf("(%d", numbers[0]);
- for (i = 1; i < n ; i++)
- {
- printf(",%d", numbers[i]);
- }
- printf(")\n");
- }
- void filling(int amount, int cur, int n)
- {
- if (cur == n - 1)
- {
- if (amount % liters[cur] == 0)
- {
- numbers[cur] = amount / liters[cur];
- showResult(n);
- numbers[cur] = 0;
- }
- }
- else
- {
- numbers[cur] = amount / liters[cur];
- while (numbers[cur] >= 0)
- {
- filling(amount - numbers[cur] * liters[cur], cur + 1, n);
- numbers[cur]--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement