CricInfoProblem code: CRICINFO |
All submissions for this problem are available.
I guess the most visited site of the past 3 months is www.cricinfo.com. First World Cup Cricket, then Australia tour to Bangladesh and now IPL T20. I believe there are lots of cricket fans among you. So I do not need to describe the game rule. But for the purpose of this problem here is short description of scoring. Any rule out of this problem description is not applicable for this problem.
For this problem we will use only the following outcomes in a ball:
| Possible Outcome in a Ball | Runs | Is the Ball valid? |
| . (dot) | 0 | Yes |
| 1 | 1 | Yes |
| 2 | 2 | Yes |
| 3 | 3 | Yes |
| 4 | 4 | Yes |
| 6 | 6 | Yes |
| Wd | 1 | No |
| 1Wd | 2 | No |
| 2Wd | 3 | No |
| 4Wd | 5 | No |
| Nb | 1 | No |
| 1Nb | 2 | No |
| 4Nb | 5 | No |
| 6Nb | 7 | No |
| W | 0 | Yes |
(Wd stands for Wide, Nb for No Ball and W for Wicket)
In cricinfo we always watch the score card. In cricket an over consists of 6 valid balls. A score card of an over may look like below:
| 1 | . | W | . | Wd | Nb | . | 6 |
In this over there were 1 wicket and 9 runs. In the last over of second innings of a match, a team requires N runs to win. You are to output number of ways of the outcome of the over. Note that, as you are watching second innings of the match, so it may be possible that he can score N runs in first 4 balls and win the match. That means, it is not necessary to play an entire over to score N runs. Also suppose you do not know how many wickets are already gone. So it may also be possible that after a few wicket falls they are all out. Also note that, if a team scores greater or equal to N runs the team wins and does not play any ball.
Input
First line contains number of test case T (T <= 10000). For each test a line contains N (1 <= N <= 10000).
Output
For every test case, output the case number and number of ways of outcome of the last over where the team needs N runs to win. As the answer can be very big, so output in mod 10000007.
Example
Input: 1 1 Output: Case 1: 946
| Author: | admin |
| Date Added: | 28-10-2011 |
| Time Limit: | 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, C99 strict, CPP 4.3.2, JAVA |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions
