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
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).
#include<bits/stdc++.h>
using namespace std;
typedef long long INT;
INT dp[65];
int main(){
dp[1]=1,dp[2]=2,dp[3]=3;
for(int i=4;i<=62;i++)
dp[i]=dp[i-3]+dp[i-1]+1;
int n;
while(scanf("%d",&n)!=EOF){
printf("%lld\n",dp[n]);
}
return 0;
}
HDU5366——The mook jong——dp的更多相关文章
- HDU5366 The mook jong (DP)
The mook jong 问题描述 ZJiaQ为了强身健体,决定通过木人桩练习武术.ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木 ...
- 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 ...
- The mook jong
The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65 ...
- BC之The mook jong
Problem Description ZJiaQ want to become a strong man, so he decided to play the mook jong.ZJiaQ wan ...
- HDU 5366:The mook jong 递推
The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit ...
- HDU 5366 The mook jong (简单DP)
题意:ZJiaQ希望把木人桩摆在自家的那个由1*1的地砖铺成的1*n的院子里.由于ZJiaQ是个强迫症,所以他要把一个木人桩正好摆在一个地砖上,由于木人桩手比较长,所以两个木人桩之间地砖必须大于等于两 ...
- HDU 5366 The mook jong
先暴力写了一个DFS,然后找规律.. #include<cstdio> #include<cstring> #include<cmath> #include< ...
- 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 dp 递推
The mook jong Accepts: 506 Submissions: 1281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65 ...
随机推荐
- dubbo事件通知机制 (2)
此文已由作者赵计刚授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 142 * 反射执行xxxService.onthrow方法:至少要有一个入参且第一个入参类型为T ...
- Binder学习笔记(十一)—— 智能指针
轻量级指针 Binder的学习历程爬到驱动的半山腰明显感觉越来越陡峭,停下业务层的学习,补补基础层知识吧,这首当其冲的就是智能指针了,智能指针的影子在Android源码中随处可见.打开framewor ...
- SingleClass单例类
前言 对于一个单例类,无论初始化单例对象多少次,在程序的整个生命周期内,只会创建一个类的实例对象,而且只要程序不被杀死,该实例对象就不会被释放,并且该对象是全局的,能够被整个系统访问到. 在应用这个模 ...
- oracle如何去除字符串中的重复字符
create or replace function remove_rame_string(oldStr varchar2, sign varchar2) return varchar2 is /** ...
- js 遍历tree的一个例子(全遍历)
全遍历 亲测真是有效. 工作中遇到的问题应该算是比较有价值的问题. <!DOCTYPE html> <html lang="en"> <head> ...
- poj2823滑动窗口(单调队列)
题目传送门 题意:给你一个长度为n的数列,然后用一个长度为k的窗口去框(k<n)每次保存k这个窗口中的最大值和最小值,输出. 思路:这道题最朴素的on2的做法铁定超时,然后我想过一个nlogn的 ...
- poj3020 建信号塔(匈牙利算法 最小覆盖边集)
Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10518 Accepted: 518 ...
- html一些常用的符号
< : < > : > & : & " : " @ : © ® : ...
- hdu1166 敌兵布阵 线段树(区间更新)
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- ZPL JS 调用共享打印机
<script type="text/javascript"> function printZpl(zpl) {var printWindow = window.ope ...