博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 1185 经典状压dp
阅读量:7016 次
发布时间:2019-06-28

本文共 669 字,大约阅读时间需要 2 分钟。

做了很久的题 有注释

#include
#include
#include
#include
#include
using namespace std;int dp[107][107][107];///二维记录上一次 三维记录此次///dp[i][k][j]=max(dp[i][k][j],dp[i-1][t][k])+num[j]; t为枚举数且满足与 k j 的条件///初始化can num数组减少时间///如果不使用can数组来记录 memset都会超时int can[107];int num[107];int n,m;int c[107];char s[107];bool ok(int x){ if(x&(x<<1)) return false; if(x&(x<<2)) return false; return true;}int main(){while(~scanf("%d%d",&n,&m)){ for(int i=0;i
0) { if(x&1)num[w]++; x>>=1; } w++; } } for(int i=0;i

  

 

转载于:https://www.cnblogs.com/rayrayrainrain/p/5406604.html

你可能感兴趣的文章
撬动智能家居市场 智慧家庭“最强大脑”被激活
查看>>
聊聊springcloud的GatewayControllerEndpoint
查看>>
聊聊sentinel的SentinelResourceAspect
查看>>
聊聊flink的SpoutWrapper
查看>>
聊聊flink的StateDescriptor
查看>>
git 使用教程,常用命令
查看>>
使用SVI实现Vlan间路由
查看>>
Linux学习笔记5月28日任务
查看>>
解决Td内容为空时不显示边框的问题-兼容IE、firefox、chrome
查看>>
SylixOS x86中断探测(二)
查看>>
HDFS总结
查看>>
scala 中导出excel
查看>>
http长轮询&短轮询
查看>>
Android 应用换肤功能(白天黑夜主题切换)
查看>>
Linux编程操作知识整理(continued)
查看>>
2012.8.13 onEnter与触摸事件
查看>>
基于 HTML5 WebGL 的 3D 棉花加工监控系统
查看>>
[redis] 获得 database, key, value
查看>>
swift之mutating关键字
查看>>
Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的W...
查看>>