HDU 2047 Ox's EOF Beef Skewer (Recursive)

Source: Internet
Author: User
Tags time limit

Ox's EOF Beef skewer

http://acm.hdu.edu.cn/showproblem.php?pid=2047

Time limit:2000/1000 MS (java/others)

Memory limit:65536/32768 K (java/others) Problem Description

This year's ACM summer Team A total of 18 people, divided into 6 teams. One of the teams, called EOF, consists of a class of 04 cows, XC, and 05 coy. In the common training life, we have established a deep friendship, a cow is ready to do something to commemorate this passion burning years, think about it, a cow from the home a fine beef jerky, ready to carve a length of n by "E" "O" "F" A string of three characters (which can have only one or two characters, but absolutely no other characters), while an ox prohibits the presence of O in the string, he believes that "OO" looks like an angry eye and does not work well. You, the NEW acmer,eof admirer, can help a cow. How many different strings are there to meet the requirements? PS: An ox also has a little secret, is ready to the carved with EOF beef jerky, as a mysterious gift to hang 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

The input data contains multiple test instances, one row for each test instance, and an integer n consisting of (0<n<40).

Output

For each test instance, please output all the required coating methods, and each instance's output occupies one row.

Sample Input

12

Sample Output

38

Thought See http://blog.csdn.net/lostaway/article/details/5742571

Complete code:

/*0ms,204kb*/
    
#include <cstdio>  
    
long long f[40];  
    
int main ()  
{  
    int i, n;  
    F[1] = 3L, f[2] = 8L;  
    for (i = 3; i < ++i) F[i] = (F[i-1] + f[i-2]) << 1;  
    while (~SCANF ("%d", &n))  
        printf ("%i64d\n", F[n));  
    return 0;  
}

This article URL address: http://www.bianceng.cn/Programming/sjjg/201410/45513.htm

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.