#P9034. Multiset Mystery

    ID: 22194 Type: Default 1000ms 256MiB

Multiset Mystery

Multiset Mystery

Little S doesn’t like sets, natural numbers, summation, product, minimum, maximum, nor the \(\operatorname{mex}\) function, so he created this problem.

Given two integers \(n\) and \(k\), count the number of multisets \(S\) of size \(k\) (repetition allowed) satisfying the following conditions:

  • For every \(x \in S\), \(0 \le x \le n\).
  • The product of all elements equals the minimum element: \[ \prod_{x\in S} x = \min_{x\in S} x. \]
  • The sum of all elements equals the sum of the minimum element, the maximum element, and \(\operatorname{mex}(S)\): \[ \sum_{x\in S} x = \min_{x\in S} x + \max_{x\in S} x + \operatorname{mex}(S), \] where \(\operatorname{mex}(S)\) is defined as the smallest nonnegative integer that is not present in \(S\).

Note that a multiset is an unordered collection allowing repeated elements.

Input Format: A single line containing two integers \(n\) and \(k\).

Output Format: Output a single integer: the number of multisets \(S\) satisfying the given conditions.

It is guaranteed that the constraints are small enough to allow an exhaustive search solution.

inputFormat

The input consists of one line with two integers \(n\) and \(k\), where \(0 \le n \le 50\) and \(1 \le k \le 50\) (the constraints are small).

outputFormat

Output a single integer — the number of multisets \(S\) satisfying the conditions.

sample

1 2
1