시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 256 MB | 29 | 24 | 24 | 82.759% |
The coach wants his team members to run up the stadium steps taking either one or two steps with each stride so that:
The coach wants to know for a given (necessarily even) number of steps how many different ways there are to run the steps and satisfy his rules.
For example, with six steps (three for each leg), there are 4 possibilities:
2211, 2112, 1221, 1122 (right leg strides are in highlighted type)
With eight steps (four for each leg) there is only one possibility since there must be at least as many two step strides as one step strides:
2222
For this problem, you will write a program that calculates the number of different ways there are to run the steps that satisfy the coach’s four criteria.
The first line of input contains a single integer P, (1 ≤ P ≤ 10000), which is the number of data sets that follow. Each data set should be processed identically and independently.
Each data set consists of a single line of input. It contains the data set number, K, followed by an even integer which is the total number of steps to be run, S, (2 ≤ S ≤ 100).
For each data set there is a single line of output. The single output line consists of the data set number, K, followed by a single space followed by the number of different ways of running the steps that satisfy the coach’s four criteria.
5 1 6 2 8 3 10 4 12 5 60
1 4 2 1 3 9 4 37 5 40197719157