The mook jong
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).
There ar multiply cases. For each case, there is a single integer n( 1 < = n < = 60)
Print the ways in a single line for each case.
1
2
3
4
5
6
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的更多相关文章
- BC之The mook jong
Problem Description ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ wan ...
- HDU5366 The mook jong (DP)
The mook jong 问题描述 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)Tot ...
- HDU 5366:The mook jong 递推
The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit ...
- 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 ...
- HDU 5366 The mook jong (简单DP)
题意:ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两 ...
- 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 ...
- HDU 5366 The mook jong
先暴力写了一个DFS,然后找规律.. #include<cstdio> #include<cstring> #include<cmath> #include< ...
- HDU 5366 dp 递推
The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65 ...
随机推荐
- Myeclipse优化配置
#utf8 (do not remove)#utf8 (do not remove)-startup../Common/plugins/org.eclipse.equinox.launcher_1.2 ...
- CentOS 7.3 安装MySQL 5.7并修改初始密码
在CentOS 7.3 下安装MySQL 5.7并修改初始密码,Windows下安装MySQL 5.7 见 http://www.linuxidc.com/Linux/2017-11/148521.h ...
- vs报错 "多步操作产生错误。请检查每一步的状态值"
今天在开发一个插件图表控件,在实例化后向数据库Update时候,报出此错误,刚开始以为是我用的异步方法,在调用程序的句柄的时候的线程问题,索性改成了同步方法,仍然报出此错误.后来Debug和排错,定位 ...
- Altium Designer chapter3总结
绘制电路原理图中需要注意的如下: (1)元件库的操作:元件库的加载和卸载.查找元件. (2)元件操作: 1.放置元件(元件库中,place part,快捷键)中place part中的history可 ...
- TensorFlow学习笔记3-从MNIST开始
TensorFlow学习笔记3-从MNIST开始学习softmax 本笔记内容为"从MNIST学习softmax regression算法的实现". 注意:由于我学习机器学习及之前 ...
- Python几行代码实现邮件发送
话不多说直接进入正题 首先我们需要安装一个名为'zmail'的包,终端执行'pip install zmail'即可实现安装. 直接上代码 import zmail mail = { 'subject ...
- MYSQL 的七种join
建表 在这里呢我们先来建立两张有外键关联的张表. CREATE DATABASE db0206; USE db0206; CREATE TABLE `db0206`.`tbl_dept`( `id` ...
- 设置div标签可以输入文字
1.contenteditable 属性可以设置div标签为克输入标签, 2.input和textarea虽然是常用的输入标签,但是这两个标签不能设置最大高度和最小高度, 随意如果想随着输入的内容 ...
- stl(set和map)
http://codeforces.com/gym/101911/problem/A Recently Monocarp got a job. His working day lasts exactl ...
- python 实现加法
https://ac.nowcoder.com/acm/contest/338/G 链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 题目描述 Th ...