Ones and twos
Problem Statement:
Shane is a brilliant batsman. But he is very superstitious. Once before a match he
was asked by his mother to do a weird ritual during his batting. According to her
mother, he had a high probability of being selected as the team captain in the
next series if he scores runs in the following way:
1. He has to score at least one run on each ball he plays
2. He can only take 1's and 2's during his innings, no 3,4,5 or 6 runs on a ball
should be made.
3. He can not make 2 runs each on 2 consecutive balls
The captain of the team gave Shane a number N, the minimum runs he has to
score. Now being a brilliant cricketer as well as a great believer, Shane can
manage both tasks, i.e scoring at least N runs, as well as scoring on each ball with
no 3's, 4's, 5's or 6's. But he does not know the number of ways in which he can
do that. Can you help him find the different number of ways in which he reaches
exactly N runs.
Since this number can be very large, considering the captain can give the number
N as big as he wants, print answer%1000000007
Note: Shane's score should be N atleast and exactly once. Eg. he cannot reach the
score N-1, and then score 2 runs on the next ball to reach N+1
Input format:
First and only line contains an integer 1<=N<=100000
Output format:
An integer that is number of possible ways Shane can score exactly N runs, with
given conditions
Answers
Answered by
1
Answer:
thanks again and have to do to make sure you the info you and the kids will send it in a few more days and then but if I do it in a few more hours of the morning mam I am not going out for a haircut in the morning mam I am so I'll let him have to go I will tomorrow be better for us if you and your mom to do to make sure I can see if you are interested I would be happy I
Similar questions