
Acm
文章平均质量分 51
waterWWAteR
东方不亮西方亮,黑了南方有北方
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
KMP
#include<iostream> #include<string> using namespace std;const int MAXN=101;int next[MAXN];void work(string s) { int cont = 0; next[0]=-1; next[1]=0; for(int i = 2; i<=s.size(); i++)原创 2017-07-31 17:59:50 · 318 阅读 · 0 评论 -
暑期集训 DAY8
KMP: 不匹配发生时,利用字符串和不匹配本身具有的、反映出的很多信息,寻找下一个匹配可能的开始位置 next数组的构造及其优化 for(;condition;) { } 和for(;;) { if(condition) continue; } 之间的区别: 前者可以看成while(condition),相当于for(;;) { if(condition) break; }原创 2017-08-01 16:46:32 · 310 阅读 · 0 评论 -
暑期集训 DAY1
/* * *求给定无序数组中每个元素的右侧最近的更大的一个数 *如给定数组 5 6 2 4 8 中,元素6 对应的answer是8 *原题 http ://codeforces.com/gym/101343/problem/H */ #include //超时 #include #include #include using namespace std; int m原创 2017-07-25 15:10:58 · 358 阅读 · 0 评论 -
暑期集训 DAY3
一、纸牌游戏,判断胜负 难点在于有可能碰到无限循环的对局 题在这里http://codeforces.com/contest/546/problem/C 可以计算得到整个游戏中所有可能的状态(state)数:(n+1)! 即:先将n张牌放到n个位置有n!种可能,再分给两个人,有(n+1)种划分方法(包括一方没分到的情况) 所以如果循环次数大于(n+1)!表示某种状态出现了两次,这时brea原创 2017-07-26 19:54:30 · 368 阅读 · 0 评论 -
【模板】Kruskal 最小生成树
// version 1 ,from hdu 1863 #pragma comment(linker, "/STACK:102400000,102400000") #include<iostream> #include<cstdio> #include<cstring> #include<algorithm>using namespace std;const int MAXN=10010; con原创 2017-07-29 11:01:48 · 315 阅读 · 0 评论 -
暑期集训 WEEK3
树状数组区间和很方便线段树建树、查询、更新、扫描线、主席树dfs、bfs原创 2017-08-10 10:02:38 · 336 阅读 · 0 评论 -
暑期集训 DAY2
----------------------- UPD2: 需要注意的: 1.重边 2.标号从0开始还是从1开始 ---------- UPD1: 是我傻了。。每次更新完length(最短距离)之后应在所有未标记的结点中寻找下一个标记点,而不是(像我之前)在当前标记点的相邻的点中找,不然,不到南墙不回头,碰到南墙就断头…… #include #include #inclu原创 2017-07-25 15:35:12 · 373 阅读 · 0 评论