上一页 1 2 3 4 5 6 7 ··· 12 下一页

2015年8月3日

BZOJ1058 [ZJOI2007]报表统计

摘要: 有两种方法第一种,用set。开两个set,第一个开multiset保存MIN_GAP的值,并逐步更新。第二个开set保存数列的值,并一步步更新MIN_SORT_GAP。其实第二个开multiset好像更好写一点? 1 #include 2 #include 3 #include 4 #incl... 阅读全文

posted @ 2015-08-03 19:11 round_0 阅读(198) 评论(0) 推荐(0) 编辑

BZOJ1012 [JSOI2008]最大数maxnumber

摘要: 暂时不知道别的,直接上了线段树 1 #include 2 #include 3 #include 4 using namespace std; 5 #define lson l,m,rt>1;18 if(pos>1,ans = -1;25 if(L<=m)ans = max(a... 阅读全文

posted @ 2015-08-03 15:45 round_0 阅读(123) 评论(0) 推荐(0) 编辑

BZOJ1002 [FJOI2007]轮状病毒

摘要: 可以找规律,题目大概的意思就是求给定的图的不同的生成树的个数可以求出n为1到10时的答案1 5 16 45 121 320 841 2205 5776 15125规律是设odd[]为奇数项的平方根那么odd[i] = odd[i-1]*3-odd[i-2];(i>=3)偶数项每个除以5也可以得到上面... 阅读全文

posted @ 2015-08-03 12:28 round_0 阅读(129) 评论(0) 推荐(0) 编辑

BZOJ1042 [HAOI2008]硬币购物

摘要: 递推+容斥原理这个题做的晕的不行,实在是糟,等回头什么时候在做一次吧。。。 1 #include 2 #include 3 using namespace std; 4 int c[5],d[5]; 5 long long f[100005]; 6 int main() 7 { 8 fo... 阅读全文

posted @ 2015-08-03 02:10 round_0 阅读(147) 评论(0) 推荐(0) 编辑

2015年8月2日

BZOJ1016 [JSOI2008]最小生成树计数

摘要: 题目意思是给出一无向图,求这个图的最小生成树的个数。这里需要知道两个关于图的最小生成树的性质吧。1.一个图的最小生成树中的某一权值的边的个数是确定的。2.这些边的作用是确定的。简单的证明:最开始的时候初始化所有节点自己为一个集合,然后首先把最小的权值的边全都加入进去,这时候应该会出现环,我们去掉几条... 阅读全文

posted @ 2015-08-02 23:23 round_0 阅读(185) 评论(0) 推荐(0) 编辑

2015年8月1日

BZOJ1053 [HAOI2007]反素数ant

摘要: 有一定的结论需要知道、、、 1 #include 2 #include 3 #include 4 using namespace std; 5 typedef long long LL; 6 LL ans,ans1,n,prime[8] = {2,3,5,7,11,13,17,19}; 7 v... 阅读全文

posted @ 2015-08-01 03:12 round_0 阅读(112) 评论(0) 推荐(0) 编辑

BZOJ1202 [HNOI2005]狡猾的商人

摘要: 带权并查集水题,头一次写这东西,纯手写。。因为n很小,所以还不用路径压缩(其实是不会除了记录父亲节点外,还记录下距离父亲节点的距离,每次查找祖先并且求出这段距离和。 1 #include 2 #include 3 #include 4 using namespace std; 5 const ... 阅读全文

posted @ 2015-08-01 00:38 round_0 阅读(127) 评论(0) 推荐(0) 编辑

2015年7月31日

BZOJ1218 [HNOI2003]激光炸弹

摘要: 暴力水题。。敲的好麻烦。用前缀和可以n^2复杂度感觉这个题就是由问题,边上的问题不知道数据是怎么算的,反正过了。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn = 5005; 6 int d... 阅读全文

posted @ 2015-07-31 23:52 round_0 阅读(108) 评论(0) 推荐(0) 编辑

BZOJ1787 [Ahoi2008]Meet 紧急集合

摘要: 水题 求出三个人每两个间的LCA,然后最小花费就是两两点之间的路径长度之和除以2 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn = 500005; 6 struct edge{ 7 in... 阅读全文

posted @ 2015-07-31 22:27 round_0 阅读(154) 评论(0) 推荐(0) 编辑

BZOJ1088 扫雷

摘要: 水题,模拟。对于最后的方案数最多只会是2,想好久,又睡了一觉才想到这个,剩下的就好办了 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define lson l,m,rt<<... 阅读全文

posted @ 2015-07-31 18:42 round_0 阅读(156) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 12 下一页

导航