ZOJ Problem Set - 2604
Consider all regular bracket sequences with one type of brackets. Let us call the depth of the sequence the maximal difference between the number of opening and the number of closing brackets in a sequence prefix. For example, the depth of the sequence "()()(())" is 2, and the depth of "((()(())()))" is 4.
Find out the number of regular bracket sequences with n opening brackets that have the depth equal to k. For example, for n = 3 and k = 2 there are three such sequences: "()(())", "(()())", "(())()".
Input file contains several test cases. Each test case is described with n and k (1 <= k <= n <= 50).
Last testcase is followed by two zeroes. They should not be processed.
For each testcase output the number of regular bracket sequences with n opening brackets that have the depth equal to k.
Separate output for different testcases by a blank line. Adhere to the format of the sample output.
3 2 37 23 0 0
Case 1: 3 Case 2: 203685956218528
Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #7