blob: bafd30ef0351fc32f026833e7fb0608fd69bf80d (
plain) (
tree)
|
|
#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));
}
|