#P1021. [NOIP 1999 提高组] 邮票面值设计(疑似错题)

[NOIP 1999 提高组] 邮票面值设计(疑似错题)

Description

Given an envelope on which at most NN stamps may be affixed, determine, for given KK types of stamps (with N+K15N+K \le 15 and assuming an unlimited supply of each type), how to design the stamp denominations to obtain the largest value MAX\mathsf{MAX} such that every postage value from 11 to MAX\mathsf{MAX} can be formed.

For example, when N=3N=3, K=2K=2: if the denominations are 11 fen and 44 fen, then every postage value between 161\sim 6 can be formed (and, of course, also 88, 99, and 1212); if the denominations are 11 fen and 33 fen, then every postage value between 171\sim 7 can be formed. One can verify that when N=3N=3 and K=2K=2, 77 is the largest consecutive postage value that can be obtained, so MAX=7\mathsf{MAX}=7, with denominations 11 fen and 33 fen.

Input Format

Two integers, representing NN and KK.

Output Format

Output a total of 22 lines.

On the first line, output the chosen denominations in ascending order.

On the second line, output MAX=S, where SS denotes the maximum consecutive postage value.

3 2

1 3
MAX=7

Hint

Translated by ChatGPT 5