A TV remote
Practice
3.2 (11 votes)
Combinatorics
Data structures
Dynamic programming
Math
Problem
34% Success 1839 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
There is a TV remote that contains three buttons:
- Next channel
- Previous channel
- Volume change
Find the number of ways such that after \(N\) clicks on the remote you remain on the same channel.
You can assume there are infinite channels.
Since the answer can be too large, print answer modulo \(1000000007\).
Input format
- The first line contains \(T\) denoting the number of test cases.
- The first line of each test case contains a single integer \(N\).
Output format
For each test case, print the number of ways modulo \(1000000007\) in a single line.
Constraints
\(1\leq T \leq 100\)
\(1 \leq N \leq 100000\)
Sum of \(N\) over all test cases does not exceed \(1e5\)
Explanation
These three moves leads to no channel changes:
- Next channel,Previous channel
- Prevoius Channel,Next Channel
- Volume change,volume change
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Loading discussions...
Similar Problems
Points:30
2 votes
Tags:
CombinatoricsGeometryMathMediumMeet in the middle
Points:30
7 votes
Tags:
CombinatoricsBasics of CombinatoricsMathC++
Points:30
2 votes
Tags:
AlgorithmsMathCombinatoricsBasics of Combinatorics
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Results
Custom Input
Run your code to see the output