The mook jong

ZJiaQ want to become a strong man, so he decided to play the mook jong。ZJiaQ want to put some mook jongs in his backyard. His backyard consist of n bricks that is 1*1,so it is 1*n。ZJiaQ want to put a mook jong in a brick. because of the hands of the mook jong, the distance of two mook jongs should be equal or more than 2 bricks. Now ZJiaQ want to know how many ways can ZJiaQ put mook jongs legally(at least one mook jong).

Input

There ar multiply cases. For each case, there is a single integer n( 1 < = n < = 60)

Output

Print the ways in a single line for each case.

Sample Input

1
2
3
4
5
6

Sample Output

1
2
3
5
8
12

   找规律题;
#include<cstdio>
#include<cstring>
using namespace std;
long long a[65];
int main()
{
    long long i,n;
    a[1]=1;
    a[2]=2;
    a[3]=3;
    a[4]=5;
    a[5]=8;
    for (i=6;i<=60;i++) a[i]=a[i-1]+a[i-3]+1;
    while (~scanf("%lld",&n)) printf("%lld\n",a[n]);
    return 0;
}
时间: 2024-12-24 06:14:31

The mook jong的相关文章

HDU 5366 The mook jong

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5366 Problem Description ![](../../data/images/C613-1001-1.jpg) ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ want to put some mook jongs in his backyard. His backyard con

The mook jong 计数DP

The mook jong ZJiaQ为了强身健体,决定通过木人桩练习武术.ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两个,现在ZJiaQ想知道在至少摆放一个木人桩的情况下,有多少种摆法. 输入描述 输入有多组数据,每组数据第一行为一个整数n(1 < = n < = 60) 输出描述 对于每组数据输出一行表示摆放方案数 1 #include &l

HDU - 5366 The mook jong (dp动态规划)

The mook jong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 62    Accepted Submission(s): 40 Problem Description ![](../../data/images/C613-1001-1.jpg) ZJiaQ want to become a strong man, so h

DP BestCoder Round #50 (div.2) 1003 The mook jong

题目传送门 1 /* 2 DP:这题赤裸裸的dp,dp[i][1/0]表示第i块板放木桩和不放木桩的方案数.状态转移方程: 3 dp[i][1] = dp[i-3][1] + dp[i-3][0] + 1; dp[i][0] = dp[i-1][1] + dp[i-1][0]; 4 比赛时二维dp写搓了,主要是边界情况的判断出错,比如dp[3][1] = 1,因为第3块放了木桩,其他地方不能再放,dp[3][0]同理 5 解释一下dp[i][1]的三种情况,可能是前面相隔2个放的方案或者是不放的

Hdu 5366 The mook jong 公式求解

The mook jong Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 ZJiaQ为了强身健体,决定通过木人桩练习武术.ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两个,现在ZJiaQ想知道在至少摆放一个木人桩的情况下,有多

HDU 5366:The mook jong 递推

The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描写叙述 ZJiaQ为了强身健体.决定通过木人桩练习武术. ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里. 因为ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,因为木人桩手比較长.所以两个木人桩之间地砖必

HDU5366——The mook jong——dp

The mook jong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 226    Accepted Submission(s): 167 Problem Description ![](../../data/images/C613-1001-1.jpg) ZJiaQ want to become a strong man, so

HDU 5336 The mook jong (DP)

The mook jong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 217    Accepted Submission(s): 160 Problem Description ![](../../data/images/C613-1001-1.jpg) ZJiaQ want to become a strong man, so

BC#50 1003 The mook jong

The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ want to put some mook jongs