| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11194 | Stairs Climbing |
|
| 12055 | Common Longest Substring |
|
Description
Bob is a man who wants to climb 3 step stairs.
Suppose he can only climb 1 or 2 step at a time.
Then , there are 3 possible ways to climb 3 step stairs
(1) 1 step + 1 step + 1 step
(2) 1 step + 2step
(3) 2 step + 1step
The question is : if Bob want to climb X step stairs.
How many possible ways are there to climp X step stairs.
Input
An integer N represents the number of testcases.
Then , there are following N lines.
Each line contain an integer X that represents the number of stairs in that testcase.
P.S. 1<= X <=40
Output
An integer represents the number of possible way to climb N stairs.
Note that you have to add '\n' at the end of output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given any 2 strings consisted by '0'to '9' , 'a' to 'z' and 'A' to 'Z', we can find a common longest substring (CLS), which belongs to the both strings, continuty, left to right, and as long as possible. The length of CLS might be 1.
For instance, the CLS of "aabbccdd" and "bbaaccdd" is "ccdd".
You now are asked to implement a code, trying to find CLS for any pair of string.
Input
There are multiple lines in each testcase. Every two lines contain a pair of strings.
The input file is ended by 'EOF'.
There's no guarantee that the length of strings in the same pair are just the same.
It is guaranteed that (s is an arbitrary string n the corresponding testcase):
- At most 10 pairs of lines in each testcase.
- testcase #1 ~ #4 : 1 ≤ | s | ≤ 50
- testcase #5 ~ #6 : 50 ≤ | s | ≤ 1000
The last two testcases are the bonus. You will get extra credit as long as you pass them.
Output
For each string pair si, please output a line contains one integer representing the length of CLS in si.
If CLS does not exist, please output 0.
Please print '\n' after each answer.