Sample Problem Statement-Pair Programming
PERMUTATION TO PASS THE EXAM
John is ready to face the Exam. There are ‘N’ paper in the exam. He can appear in one paper at a time. Even if he fails in any of the paper he has the option to approach any other paper or appear in the same paper continuously until he pass. Once he has started a paper the paper is considered open for him represented by “[” and is closed only after he pass it, represented by “]”. The only restriction is that if he appears in the next paper after getting failed in a previous one then he has to pass the current one in order to compete again in the previous paper. You have to help john to find out in how many ways he can appear in ‘N’ paper exam in order to pass in all the papers.
Input Format :
Each input line consists of a single line consisting of a single number N.
Output Format : For each input line, output a single line consisting of the number of different ways possible for the respective test case.
0 ≤ N ≤ 15
EXAMPLE 1: INPUT 2 OUTPUT 2
EXAMPLE 2: INPUT 3 OUTPUT 5
For the N=2 the solutions is 2 because in the following ways
1) John appears in the first paper, got failed in it and then appears in the next paper. Now as he cannot appear in the first paper without passing the current one, he pass the second one after a few tries and then returns to the first one and got passed in it.
2) John appears in the first paper, keep on trying there until he passes and then goes to the next paper and got passed there.
Developed by Delta Force.
Designed by NITT-Design Team.