Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2013-02-16 11:57:12 by :D
JUMP - Jhumru climbs pole |
Jhumru, the monkey is very fond of climbing the poles. After practicing, now he can jump either 1 unit or 2 units or 3 units at a time. Therefore, he thought that there are many possible ways to climb the pole of the same height. For example, if he wants to climb a pole of height 2 units, he might climb 2 units directly or he may climb 1 unit two times to reach the top of the pole, but he cannot jump to 3 units because height of pole is 2. Now, he wonders how many ways are possible to climb a pole of height H.
Since he is a monkey, he doesn't know programming. So, he asks you to find the number of ways in which he can climb the pole of height H by using only one of his 3 jumps. Since, the number of ways can be very large, output the result mod 10^8 + 7.
Input
First line of Input contains a single number T(<= 10,000), the number of Test Cases
Next T lines contains H(1 <= H <= 10^18), the height of the pole
Output
T lines each containing the number of ways in which Jhumru can climb the pole. Since the number can be very large output the number mod 10^8 + 7.
Example
Input: 3
1
2
5 Output: 1
2
11
Explanation:
For H = 1, the only possible way is to climb 1 unit.
For H = 2, he may directly climb 2 units in single step or he may climb 2 times with a height of 1 unit each.
Added by: | c[R]@zY f[R]0G |
Date: | 2013-02-15 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2013-02-16 11:00:46 :D
Problems already like this are in the set and there are some issues, so moving to tutorial and hiding. I have a strong suspicion author just keeps putting his problems back to classical. If you will insist on doing that, I will have to remove them permanently. In the future you can contact me via e-mail (see my motto/url) and I can help you review your problem ideas. |
|
2013-02-16 02:40:28 (Tjandra Satria Gunawan)(曾毅昆)
Alex right, answer for 5 should be 13... the first correct 5 term of this sequence is: 1 2 4 7 13.. Also, I feel bored with this kind of problem, no interesting twist... Last edit: 2013-02-16 02:50:30 |
|
2013-02-16 02:13:19 Alex Anderson
Also, shouldn't the answer for 5 be 13? 11111 1112 1121 1211 2111 221 212 122 311 131 113 32 23 There are already problems on spoj just like this one which are both easier and harder. Ex: http://www.spoj.com/problems/REC/ http://www.spoj.com/problems/PIBO/ http://www.spoj.com/problems/FIBOSUM/ http://www.spoj.com/problems/FIBTWIST/ http://www.spoj.com/problems/FIBOSQRT/ http://www.spoj.com/problems/NACCI/ Last edit: 2013-02-16 02:17:31 |