Poj
haha_2678
Do the impossible!!!
展开
-
Poj 1157 题解
一开始看错了题意。 记得个前面留够位置和后面留够位置就好了。 还有f别忘了清空为-99999 Code: #include #include #include #include using namespace std; int f[110][110]; int a[110][110]; int n,m; void Input() { scanf("%d%d",&n,&m); for原创 2015-01-07 13:55:25 · 357 阅读 · 0 评论 -
Poj 1050 题解
最大子矩阵和。 O(n^3) 不做太多诠释了。直接上代码,不懂评论即可。 今天尽量多刷点题 #include #include #include using namespace std; int a[110][110],n; int f[110][110]; void Input() { scanf("%d",&n); for(int i=1;i<=n;i++) for(in原创 2014-12-31 13:42:20 · 584 阅读 · 0 评论 -
Poj 1036 题解
一道dp题。 一开始看起来蒙了,但是其实很简单。 他的门是可以不动的。 也就是说你这个小偷到上一个小偷的这段时间如果大于两者fat的差的话绝对值就必定满足。 之后就是dp了 你每一个小偷都继承这上一个来枚举即可,f[i]表示第i个小偷能偷到的荣誉。 其实就是继承的时候判断一下继承的上一个是否合法即可 Code: #include #include #include #include原创 2014-12-30 13:50:26 · 387 阅读 · 0 评论 -
Poj 1018 题解
这是一道简单的dp题。 首先想想,b/p最大,就是想让b最大,p最小。 状态定义f[i][j]=前i行最小最小值为j的最小价值p,这样用b/p才最大,最后一个个枚举。(自然保证最大) 为什么一个个枚举可以呢 其实联系一下p想想就好了。 对了,还有的就是用c++ 提交 Code: #include #include #include using nam原创 2014-12-29 13:57:27 · 427 阅读 · 0 评论 -
Poj 1014 题解
第一次发poj,原百度空间已经放弃了。 还是贴个网址吧,容易找一点。 http://hi.baidu.com/scqmysgfqrajrtr 一道多重背包的题。 一开始直接背包 Code: #include #include #include #include using namespace std; int a[7];int t=0; bool v[21000]; void原创 2014-12-28 15:49:55 · 334 阅读 · 0 评论 -
Poj 1273 题解
模板题,dinic网络流,直接上代码。 Just prepare for the exam。 记得数组开大,多组数据。 Code: #include #include #include #include using namespace std; struct node { int x,y,c,next,other; }a[6110000]; int len,first[1110000]原创 2015-01-10 13:56:16 · 281 阅读 · 0 评论 -
Poj 1061 题解
成绩出来了,看起来是挺高的,但年级排名感觉还是没升. 感觉要好好学习了. 昨天定了一个目标,有点不切实际.(hehe) 这是我学Exgcd的第一题,记得以前打过。 学回来挺简单的。 if(c%d!=0) { printf("Impossible\n"); return ; } x=x*(c/d); y=y*(c/d); LL k=a*b/d; x原创 2015-01-30 11:14:15 · 303 阅读 · 0 评论 -
Poj 1579 题解
记忆性搜索,注意判断数组的边界 #include #include #include #include using namespace std; int f[30][30][30],a,b,c; int ans; int dfs(int x,int y,int z) { if(x<=0||y<=0||z<=0) return f[0][0][0]=1; else if(x>20||y>2原创 2015-01-09 13:42:53 · 270 阅读 · 0 评论 -
Poj 1458 题解
简单的二维一边推 Code: #include #include #include #include #include using namespace std; char st1[1100],st2[1100]; int f[1100][1100]; void Solve() { memset(f,0,sizeof(f)); for(int i=1;i<=strlen(st1+1);i原创 2015-01-09 13:22:31 · 282 阅读 · 0 评论 -
Poj 1163 题解
打完后编译都没编译直接acv. Code: #include #include #include #include using namespace std; int a[1100][1100],n; int f[1100][1100]; void Input() { scanf("%d",&n); for(int i=1;i<=n;i++) { for(int j=1;j<原创 2015-01-08 12:53:53 · 321 阅读 · 0 评论 -
Poj 1170 题解
本来想用5个数表达一个状态的。 但是先起来麻烦。 结果用5维数组做咯。 离散化了。 还是一次ac Code: #include #include #include #include #include using namespace std; struct node { int p[6]; int val; }a[1100]; int ls=0,len=0; mapmp; int原创 2015-01-08 13:42:57 · 324 阅读 · 0 评论 -
Poj 1088 题解
水题dp,其实就是记忆化搜索 #include #include #include #include using namespace std; int f[110][110]; int a[110][110],n,m; void Input() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) s原创 2015-01-01 00:56:19 · 283 阅读 · 0 评论