summaryrefslogtreecommitdiffstats
path: root/šola/p2/dn/23kol1a.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--šola/p2/dn/23kol1a.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/šola/p2/dn/23kol1a.c b/šola/p2/dn/23kol1a.c
new file mode 100644
index 0000000..bafd30e
--- /dev/null
+++ b/šola/p2/dn/23kol1a.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#define MAX(x,y) ((x)>(y)?(x):(y))
+int vsote (int n, int m) {
+ int r = 0;
+ if (!n)
+ return 1;
+ for (int a = 1; a <= n; a++)
+ for (int b = MAX(m, a); a*b <= n; b++)
+ if (n-a*b >= 0)
+ r += vsote(n-a*b, m);
+ return r;
+}
+int main (void) {
+ int n, m;
+ scanf("%d %d\n", &n, &m);
+ printf("%d\n", vsote(n, m));
+}