andre_joy

导航

2012年8月3日

poj 2823

摘要: 地址:http://poj.org/problem?id=2823题意:n个数里面连续的k个数,找最大和最小的。mark:优先队列,不过要重载一下cmp函数。 也可以单调队列做。代码:#include <stdio.h>#include <string.h>#include <stdlib.h>int queue[1000010];int a[1000010];int m,n;void solve(int f){ int i,j,k; int fr,la; fr = la = 0; queue[la++] = 0; for(i = 1; i < m; 阅读全文

posted @ 2012-08-03 15:33 andre_joy 阅读(174) 评论(0) 推荐(0) 编辑

zoj 3471

摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3471题意:n种气体,每两种碰在一起会产生能量,然后后者消失。自己不能跟自己撞。求产生的最大能量。mark:状态压缩dp。自己写的时候很忐忑,最后看解体报告发现跟自己思路一样,嘿嘿~代码:#include <stdio.h>#include <string.h>#include <stdlib.h>#define J1 (k|(1<<j))#define J2 (k&(1<<j))#define I 阅读全文

posted @ 2012-08-03 10:51 andre_joy 阅读(167) 评论(0) 推荐(0) 编辑