A dice string
Practice
3.7 (3 votes)
Dynamic programming
Matrix
Probability spaces
Algorithms
Probablity
Modular exponentiation
Problem
12% Success 322 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given a dice having six faces numbered as 1, 2, 3, 4, 5, and 6 respectively. You throw the dice \(n\) times and the outcomes are written serially in order to form an n-digit number. You are required to find the probability that the number formed is divisible by 11.
Input format
- The first line consists of a single integer \(T\) denoting the number of test cases
- Each of the next \(T\) lines contains a single integer \(n\) denoting the number of throws
Output format
The output must consist of \(T\) lines where each contains a single integer representing the required probability.
Print the answer modulo \(10^9+7\). If the answer is of the form \(\frac PQ\), then print \(PQ^{-1} (mod\ 10^9+7)\).
Constraints
\(1\le T\le 100\\1\le n \le 10^{18}\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
40 votes
Tags:
Dynamic ProgrammingException handlingApprovedMediumReadyOpenProbability and Statistics
Points:30
3 votes
Tags:
MathematicsMediumOpenApprovedProbability and Statistics
Points:30
Tags:
Dynamic ProgrammingApprovedMediumProbability and Statistics
Editorial