# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11194 | Stairs Climbing |
|
11200 | Tower of Hanoi |
|
13672 | Fibonacci's soup |
|
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
The Tower of Hanoi is a mathematical game puzzle. It consists of three rods, which are A, B and C. The puzzle starts with n disks in ascending order of size on rod A, the smallest at the top.
The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
1. Only one disk can be moved at a time.
2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
3. No disk may be placed on top of a smaller disk.
Write a program to simulate the moves of the disks. Print the number of disk which is moved in each step.
For example, if n = 3, the moves of each steps are:
move disk 1 from rod A to rod C
move disk 2 from rod A to rod B
move disk 1 from rod C to rod B
move disk 3 from rod A to rod C
move disk 1 from rod B to rod A
move disk 2 from rod B to rod C
move disk 1 from rod A to rod C
You should print out:
1
2
1
3
1
2
1
HINT : You can modify this sample code and implement the function 'hanoi'
#include <stdio.h>
void hanoi(int n, char A, char B, char C);
int main(){
int n;
scanf("%d", &n);
hanoi(n, 'A', 'B', 'C');
return 0;
}
Input
An integer n (0<n<20), which means the number of disk.
Output
Print out the number of disk which is moved in each step, and there is a '\n' at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Fibonacci's soup is one of the most well-known recipe in Fibonacci's hometown. Besides making soup, Fibonacci also enjoys seeking weird sequences.
Today, Fibonacci has discovered a new sequence called "DFS", which is the "Double Fibonacci Sequence". The following is the formula for the sequence:
Input
The input contains one line: nonnegative integers a, b, c, d and n.
a, b, c, d ≤ 100, n ≤ 50
Output
Output one line, including fn and gn.
Please remember to print '\n' at the end.