NOIP '99 P4 - Stamp Face Value Design

View as PDF

Submit solution

Points: 12 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type

Given an envelope, at most N stamps are allowed to be pasted. Calculate how to design the face value of stamps so for the maximum value MAX where every postage between 1 and MAX can be obtained if given K (N+K \le 13) types of stamps (assuming there are infinitely many stamps of each type).

For example, N = 3, K = 2, if the face values are 1 cent and 4 cents, then every postage between 1 \sim 6 cents will be able to be obtained. Every postage between 1 \sim 7 cents can be obtained if the face values are 1 cent, and 3 cents, respectively. It can be proven that when N = 3, K = 2, 7 cents is the maximum continuous postage that can be obtained, so MAX = 7 and the face values are 1 cent and 3 cents respectively.

Input Specification

The input contains two integers, N and K.

Output Specification

There should be two lines of output.

The first line of output should contain the face values chosen to maximize MAX in increasing order.

Output MAX=S on the second line, where S represents the maximum postage that can be obtained.

Sample Input

3 2

Sample Output

1 3
MAX=7

Problem translated to English by Tommy_Shan.


Comments

There are no comments at the moment.