Hdu Ox's EOF Beef Skewer (Java)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.