Submit | All submissions | Best solutions | Back to list |
MAIN113 - Special String |
A string of letters X, Y, Z is special if there are three consecutive letters from which one is X, one is Y, and one is Z. For example, XYZXYZ is special, while XXYYZ is not. Your task is to calculate how many such strings of length n are not special.
Input
First line contains an integer T (1 <= T <= 30) which denotes the total number of test cases. Each test case contains an integer N (1 <= N <= 30) in a single line.
Output
For each test case print total number of strings which have a length N and are not special.
Example
Input: 1 2 Output: 9
Added by: | amit karmakar |
Date: | 2011-08-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
||||||
2012-09-01 19:41:45 Sardar Khan
@akuya: thnkx ur comment helped!!:) |
||||||
2012-08-18 09:54:05 BOND
I had to comment on this, it took nearly 3 hrs, and now feeling relieved after seeing that green bar... |
||||||
2012-08-17 17:41:18 Zhiang
@admin..plz remove the comment of akuya its enough to solve the problem |
||||||
2011-11-13 22:15:23 Rajesh Kumar
More test cases please... |
||||||
2011-09-21 16:59:16 Gaurav Mittal
is xxyz special? |
||||||
2011-09-20 09:37:05 Gunjit
plz give sm more test cases... |
||||||
2011-09-04 12:42:44 Rachmawan Atmaji Perdana
Integer is not enough |
||||||
2011-08-25 16:45:23 Alex Anderson
Why is N limited to 30? |
||||||
2011-08-24 03:02:44 Gregorius Edward
do xxyz and xyzx are special? |