Not easy series of (3)--lele RPG puzzle time limit:2000/1000ms (java/other) Memory limit:65536/32768k (Java/other) total submission (s) : 7 Accepted Submission (s): 4Problem description called "AC female killer" Super Idol Lele recently played a deep, this can be nasty many "Cole" (Lele fans, namely "Cola"), after the multi-prying, A veteran Cole finally knew the reason, originally, Lele recently studied the famous RPG puzzle:
There are rows of n squares, with red (red), powder (Pink), Green (green) Three colors each lattice, each color, requires that any adjacent squares can not be the same color, and the first and the first two squares also different colors. All the requirements of the coating method.
These are the famous RPG puzzles.
If you are Cole, I think you will be able to help Lele solve the problem, if not, look at the many beautiful pain of the Cole Girl's face, you will not stand by?
Input data contains multiple test instances, one row per test instance, and an integer n, (0<n<=50). <= "div=" ">
Output for each test instance, export all of the required coating methods, one row for each instance output.
Sample Input
1 2
Sample Output
3 6
Authorlcy
Source Recursive Solution topic exercise (for beginner)
1#include <stdio.h>2__int64 sieve[Wuyi];3 intMain ()4 {5 intI,n; sieve[1]=3; sieve[2]=6; sieve[3]=6;6 for(i=4;i<Wuyi; i++)7 {8sieve[i]=sieve[i-1]+sieve[i-2]*2;//recursion;9 } Ten while(~SCANF ("%d",&N)) One { Aprintf"%i64d\n", Sieve[n]); - } - return 0; the}
Hangzhou Electric 2045--Not Easy series of (3)--lele RPG puzzle