Problem:
Recursion, in the calculation of elements must be careful, the wrong one will spend a lot of time.
Ox's EOF Beef skewerTime
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 24625 Accepted Submission (s): 11558
Problem description This year's ACM summer training Team A total of 18 people, divided into 6 teams. There is a team called EOF, consisting of 04 levels of ox, XC, and Level 05 coy. In the common training life, we have established a deep friendship, a cow ready to do something to commemorate the burning years of passion, think, a cow from home brought a fine beef jerky, ready to carve a length of n only by "E" "O" "F" Three characters of a string (can only one or two characters, but absolutely no other characters), the Ox also prohibits the appearance of o adjacent in the string, he thought, "OO" looks like angry eyes, the effect is not good.
You, NEW Acmer,eof's admirer, can you count the number of different strings that meet the requirements?
PS: Ox also has a small secret, is ready to put this engraved with EOF beef dry, as a mysterious gift for Hangzhou Electric 50 Anniversary celebration, can imagine, when the headmaster took this piece of beef dry time how happy! Here, please allow me on behalf of Hangzhou Electric Acmer to Aniu Express thanks!
Thanks again!
Input data contains multiple test instances, one row per test instance, and an integer n, (0<n<40).
Output for each test instance, export all of the required coating methods, one row for each instance output.
Sample Input
12
Sample Output
38
Code:
Import java.util.*;p ublic class main{public static void Main (string[] args) {Scanner cin=new Scanner (system.in);d ouble[] A=new double[45];a[1]=3;a[2]=8;for (int i=3;i<45;i++) a[i]= (A[i-1]+a[i-2]) *2;while (Cin.hasnext ()) {int n= Cin.nextint (); System.out.printf ("%.0f\r\n", A[n]);}}}
Hdu Ox's EOF Beef Skewer (Java)