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 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 <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring> using namespace std; #define INF 0xfffffff
#define maxn 10005 int main()
{
__int64 n, dp[maxn] = {, , , }; while(scanf("%I64d", &n) != EOF)
{
for(int i = ; i <= n; i++)
dp[i] = dp[i-] + dp[i-];
printf("%I64d\n", dp[n]-); // 减去一种什么都不放的情况 }
return ;
}

The mook jong的更多相关文章

  1. BC之The mook jong

    Problem Description ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ wan ...

  2. HDU5366 The mook jong (DP)

    The mook jong 问题描述 ZJiaQ为了强身健体,决定通过木人桩练习武术.ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木 ...

  3. HDU5366——The mook jong——dp

    The mook jong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

  4. HDU 5366:The mook jong 递推

    The mook jong  Accepts: 506  Submissions: 1281  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit ...

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

    题目传送门 /* DP:这题赤裸裸的dp,dp[i][1/0]表示第i块板放木桩和不放木桩的方案数.状态转移方程: dp[i][1] = dp[i-3][1] + dp[i-3][0] + 1; dp ...

  6. HDU 5366 The mook jong (简单DP)

    题意:ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两 ...

  7. BestCoder Round #50 (div.1) 1003 The mook jong (HDU OJ 5366) 规律递推

    题目:Click here 题意:bestcoder 上面有中文题目 分析:令f[i]为最后一个木人桩摆放在i位置的方案,令s[i]为f[i]的前缀和.很容易就能想到f[i]=s[i-3]+1,s[i ...

  8. HDU 5366 The mook jong

    先暴力写了一个DFS,然后找规律.. #include<cstdio> #include<cstring> #include<cmath> #include< ...

  9. HDU 5366 dp 递推

    The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65 ...

随机推荐

  1. PHP 调试 - Xdebug

    PHP 调试指南.pdf PHP 程序员的调试技术 根据要调试的对象的不同,采取的方法也不一样: 调试 web 应用:对于 web 应用,可以在浏览器中安装插件,或者在 IDE 中设置,下面的设置二选 ...

  2. C. Roads in Berland

    题目链接: http://codeforces.com/problemset/problem/25/C 题意: 给一个最初的所有点与点之间的最短距离的矩阵.然后向图里加边,原有的边不变,问加边后的各个 ...

  3. Bootstrap,Bagging and Random Forest Algorithm

    Bootstrap Method:在统计学中,Bootstrap从原始数据中抽取子集,然后分别求取各个子集的统计特征,最终将统计特征合并.例如求取某国人民的平均身高,不可能测量每一个人的身高,但却可以 ...

  4. springboot连接mysql报错:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException

    nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. ...

  5. mysql使用localhost可以访问,使用ip地址无法访问

    本地安装的mysql服务,使用localhost可以连接,ip地址发无法连接: 解决办法: 进入mysql命令界面,输入select host,user from mysql.user; host字段 ...

  6. sql server 2008查询时报错,消息:8155,没有为'a'的列2指向任何列

    解决方法1: 关掉Sql Server再打开, 重新查询 解决方法2: select T.* from(   select row_number() over(order by age desc) a ...

  7. E Easy problem

    链接:https://ac.nowcoder.com/acm/contest/338/E来源:牛客网 Zghh likes number, but he doesn't like writing pr ...

  8. ajax axios 下载文件时如何获取进度条 process

    最近项目需要做一个下载文件的进度条,看网上上传文件进度条下载,特分享出来方便大家查阅 <!DOCTYPE html> <html> <head>     <m ...

  9. mysql 8.0.15忘记密码重置方法

    1.打开命令窗口cmd,输入命令:net stop mysql,停止MySQL服务, 2.开启跳过密码验证登录的MySQL服务 输入命令 mysqld --console --skip-grant-t ...

  10. shell判断用户是否已经在系统中登录