We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #116: Red, green or blue tiles

Project Euler #116: Red, green or blue tiles

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 116 from projecteuler.net

A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four).

If red tiles are chosen there are exactly seven ways this can be done.

If green tiles are chosen there are three ways.

And if blue tiles are chosen there are two ways.

Assuming that colours cannot be mixed there are ways of replacing the black tiles in a row measuring five units in length.

How many different ways can the black tiles in a row measuring units in length be replaced if colours cannot be mixed and at least one coloured tile must be used?

As the answer can be extremely large, print it modulo .

Input Format

First line contains an integer denoting the number of test cases.
Each of the following lines contain one integer .

Constraints

Output Format

For each of test cases print one line containing a single integer - the answer to a problem modulo .

Sample Input

1
5

Sample Output

12

Author

Alex_2oo8

Difficulty

Easy

Max Score

100

Submitted By

768

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy