1999-2000
ACM North Central Regional Programming Contest
Problem 5
— Going Down!
Every positive integer n can be expressed as the sum of one or more non-increasing sequences of one or more positive integers, each less than or equal to n. For example, the integer 4 can be expressed as 1 + 1 + 1 + 1, or 2 + 1 + 1, or 2 + 2, or 3 + 1, or 4. In this problem you are determine the number of sequences that meet this requirement for a particular values of n, and also have exactly k terms. For example, with n = 4 and k = 2, there are two sequences that meet the criteria: 2 + 2 and 3 + 1. Note that 1 + 3 does not satisfy the requirements of the problem, as the sequence in that case is not non-increasing.
There will be multiple test cases. For each test case the input will contain values for n and k. A pair of zeroes will follow the last test case. The value of n will always be at least 1 and no larger than 100. The value of k will be at least 1 and no larger than n.
For each test case, print a line containing the case number; these are numbered sequentially, starting with 1. Then display the number of non-increasing sequences including exactly k integers with sums equal to n, including the values of k and n. The grammar of your response should be correct! The example output shown below illustrates an acceptable format.
5 2
5 1
2 2
0 0
Case
1: 2 non-increasing sequences with 2 integers have 5 as their sum.
Case
2: One non-increasing sequence with one integer has 5 as its sum.
Case
3: One non-increasing sequence with 2 integers has 2 as its sum.