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. 快速测试端口的连通性(HTTP/HTTPS)

    ping 仅限 80 端口,命令中无法指定端口: C:\Users\Administrator>ping kikakika.com 遗失对主机的连接. 正在 Ping kikakika.com ...

  2. 单击EasyUI的datagrid行时不选中

    单击EasyUI的datagrid行时不选中,行背景色不变,点击选择框checkbox时选中该行 核心代码: $("#msgList").datagrid({        url ...

  3. Django csrf,xss,sql注入

    一.csrf跨站请求伪造(Cross-site request forgery) CSRF的攻击原理:简单说就是利用了高权限帐号(如管理员)的登录状态或者授权状态去做一些后台操作,但实际这些状态并没有 ...

  4. JNDI配置笔记

    先在tomcat Context.xml配置文件中配置 <Resource name="jdbc/elifecrm" type="javax.sql.DataSou ...

  5. jsoncpp解析非json串

    转自:https://www.cnblogs.com/huojing/articles/5927488.html 由于Jsoncpp解析非法json时,会自动容错成字符类型.对字符类型取下标时,会触发 ...

  6. 数据导出 写入到excle文件

    import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.poi ...

  7. P4843 清理雪道(上下界网络流)

    P4843 清理雪道 上下界最小流 我们先搞一遍上下界可行流(转) 回忆上下界最大流的写法:在可行流的残量网络$s\ -\ t$上跑最大流,答案为可行流$+$残量网络的最大流 那么上下界最小流的写法呢 ...

  8. [转]ORACLE优化器RBO与CBO的区别

    RBO和CBO的基本概念 Oracle数据库中的优化器又叫查询优化器(Query Optimizer).它是SQL分析和执行的优化工具,它负责生成.制定SQL的执行计划.Oracle的优化器有两种,基 ...

  9. jsp:useBean的属性class值一直报错的问题

    先附上代码: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8 ...

  10. 68.Palindromic Substrings(回文字符串的个数)

    Level:   Medium 题目描述: Given a string, your task is to count how many palindromic substrings in this ...