SGU 310. Hippopotamus( 状压dp )
题目大意:给N块板, 有A,B2种类型的板, 要求任意M块连续的板中至少有K块B板.1≤n≤60,1≤m≤15,0≤k≤m≤n.
dp(x, s)表示第x块板, x前M块板的状态为s, 然后合法状态转移就行了.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
310. Hippopotamus
Memory limit: 65536 kilobytes
output: standard
After fixing your roof, you still think that it looks unpretty. So you opt for a new one, consisting of n consecutive long narrow boards. You have two types of boards: wooden ones and iron ones, giving you an amazing total of 2n possible roofs.
But the safety should not be left aside. Having considered the weight and the cruising speed of a falling hippopotamus, you decide to have at least k iron boards among every m consecutive boards.
How many possibilities do you have?
The input file contains three integers, n, m and k, separated by spaces and/or line breaks. 1 ≤ n ≤ 60, 1 ≤ m ≤ 15, 0 ≤ k ≤ m ≤ n.
Output the number of possibilities.
sample input |
sample output |
10 2 1 |
144 |
sample input |
sample output |
5 5 2 |
26 |
sample input |
sample output |
3 2 2 |
1 |
SGU 310. Hippopotamus( 状压dp )的更多相关文章
- SGU 223 Little Kings(状压DP)
Description 用字符矩阵来表示一个8x8的棋盘,'.'表示是空格,'P'表示人质,'K'表示骑士.每一步,骑士可以移动到他周围的8个方格中的任意一格.如果你移动到的格子中有人质(即'P'), ...
- 状态压缩动态规划(状压DP)详解
0 引子 不要999,也不要888,只要288,只要288,状压DP带回家.你买不了上当,买不了欺骗.它可以当搜索,也可以卡常数,还可以装B,方式多样,随心搭配,自由多变,一定符合你的口味! 在计算机 ...
- BZOJ 1087: [SCOI2005]互不侵犯King [状压DP]
1087: [SCOI2005]互不侵犯King Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 3336 Solved: 1936[Submit][ ...
- nefu1109 游戏争霸赛(状压dp)
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=1109 //我们校赛的一个题,状压dp,还在的人用1表示,被淘汰 ...
- poj3311 TSP经典状压dp(Traveling Saleman Problem)
题目链接:http://poj.org/problem?id=3311 题意:一个人到一些地方送披萨,要求找到一条路径能够遍历每一个城市后返回出发点,并且路径距离最短.最后输出最短距离即可.注意:每一 ...
- [NOIP2016]愤怒的小鸟 D2 T3 状压DP
[NOIP2016]愤怒的小鸟 D2 T3 Description Kiana最近沉迷于一款神奇的游戏无法自拔. 简单来说,这款游戏是在一个平面上进行的. 有一架弹弓位于(0,0)处,每次Kiana可 ...
- 【BZOJ2073】[POI2004]PRZ 状压DP
[BZOJ2073][POI2004]PRZ Description 一只队伍在爬山时碰到了雪崩,他们在逃跑时遇到了一座桥,他们要尽快的过桥. 桥已经很旧了, 所以它不能承受太重的东西. 任何时候队伍 ...
- bzoj3380: [Usaco2004 Open]Cave Cows 1 洞穴里的牛之一(spfa+状压DP)
数据最多14个有宝藏的地方,所以可以想到用状压dp 可以先预处理出每个i到j的路径中最小权值的最大值dis[i][j] 本来想用Floyd写,无奈太弱调不出来..后来改用spfa 然后进行dp,这基本 ...
- HDU 1074 Doing Homework (状压dp)
题意:给你N(<=15)个作业,每个作业有最晚提交时间与需要做的时间,每次只能做一个作业,每个作业超出最晚提交时间一天扣一分 求出扣的最小分数,并输出做作业的顺序.如果有多个最小分数一样的话,则 ...
随机推荐
- C语言中的回调函数
C语言中通过函数指针实现回调函数(Callback Function) ====== 首先使用typedef定义回调函数类型 ====== typedef void (*event_cb_t)(co ...
- Nodejs随笔(一):Hello World!
声明:本人用的是Ubuntu 14.04 LTS 系统. 一.Nodejs安装: <1>直接apt-get安装,最简单:sudo apt-get install nodejs <2& ...
- There is no result type defined for type 'json' mapped with name 'success'. Did you mean 'json'?
错误信息: 严重: Exception starting filter struts2 Unable to load configuration. - action - file:/C:/Users/ ...
- JS 精粹(三)
(一)基本问题 JS的数据类型(不是数据结构)分:简单数据类型(undefined\null\boolean\string\number\symbol).复杂数据类型(object). 对象是可变的键 ...
- qrcode各版本/各类型容量支持表
1.qrcode共有40个版本,支持各种类型数据.个人一般统一转换成8位字节进行算法存储.(汉字 --uff8占用3个字节)
- C语言学习——C程序的运行机理
预处理: #include<xxx> 尖括号表示库文件:#include"xxx" 双引号表示自己写的文件. #include后面的文件格式允许多种,但若要是" ...
- Swift 断言
assert(条件,"输出信息"); 如: let age=-1; assert(age>=0,"age要大于0");
- activiti框架 数据库设计说明
1.结构设计 1.1. 逻辑结构设计 Activiti使用到的表都是ACT_开头的. ACT_RE_*: ’RE’表示repository(存储),RepositoryService接口所操作的 ...
- IS--A与 Has-a 区别
- 工作备份 build.gradle
apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '22.0.0' de ...