Parentheses Problem
Time Limit: 1 sec
The Problem
Suppose I have n pair of parentheses, both starting and ending. The Staring one is “(“ and the ending is “)”.
Example:
If n = 2, I have two starting and two ending Parentheses. I can match parenthesis in two ways (()) and () ().
If n = 3, I can form these in 5 ways, those are ((())), () (()), () () (), (()) () and (() ()).
The Input
The input contains a number in every line n>0 denotes the number of pair of parenthesis. The input number is not greater than 20. Input is terminated by EOF.
The Output:
For each line of input, you have to print the number of expressions containing n pair of parentheses, which are correctly matched with the case number in a separate line.
Sample Input:
2
3
Sample Output:
Case 1: 2
Case 2: 5
[School Level]
Inter School & College Programming Contest (ISCPC) 2015
Problem Setter: Parag Paul