summaryrefslogtreecommitdiffstats
path: root/šola/p2/dn/23kol1a.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-14 22:19:27 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-14 22:19:27 +0200
commitf65e7733a59efe8bfd8cfe33e699c1e750deb274 (patch)
treeae8918ee0766f26f3c74b1d97a5edbbb550d5646 /šola/p2/dn/23kol1a.c
parentdn08 (diff)
downloadr-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar.gz
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar.bz2
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar.lz
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar.xz
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.tar.zst
r-f65e7733a59efe8bfd8cfe33e699c1e750deb274.zip
Diffstat (limited to 'šola/p2/dn/23kol1a.c')
-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));
+}