- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 HDU 4009 Transfer water
最小树形图模板题#include #include #include #include #include using namespace std;int n,X,Y,Z;struct node{ int x,y,z;}vill[1200];const int MAXM=40010;const int MAXN=1010;const int INF=0x3f3f3f3f
2015-05-31 12:37:00 425
原创 HDU 4004 The Frog's Games
二分最小的能力值,然后对该值进行判断,看是否能至多m步跳到河对岸#include #include #include #include #include using namespace std;int a[500055];int L,n,m;int maxn;int check(int v){ int num=0; int i=0; int pos=1; while(
2015-05-28 19:53:12 491
原创 HDU 4006 The kth great number
动态求第k大的数,只需维护一个长度为k的优先队列#include #include #include #include #include #include using namespace std;int main(){ int n,k; while(scanf("%d%d",&n,&k)!=EOF){ priority_queue, greater >
2015-05-27 08:22:13 356
原创 poj 2001 Shortest Prefixes
题目要求的是每个单词的直接前缀是什么,什么是直接前缀呢,直接前缀就是以该直接前缀的子树有且只有该单词 所以,我们只需要沿着以该单词构建的字典树走,输出所有cnt>1的结点和最后一个cnt==1的结点既得答案#include #include #include #include using namespace std;char ch[1500][30];int le=1;str
2015-05-10 16:18:14 402
原创 Codeforces 466C Number of Ways
题意很容易理解,要求的是如何将一段序列划分为3段,每一段的和都为sum/3,求所有的划分数自己没想出来,看的标准题解(捂脸)1.如果序列的和不能整除3,那么划分数肯定为02.如果序列的和能整除3,那么我们只需要找到所有使得前i个点之和为sum/3的这些点,然后看在这些点之后有多少个点能使从第一个点开始到他们这些点为止使得序列之和为sum*2/3,最后将这些点的个数累加起来得到答案。
2015-05-08 20:30:12 401
原创 HDU 3549 Flow Problem
最大流模板题#include #include #include #include #include using namespace std;int n,m;int g[20][20];int pre[20];int visit[20];int Augment(){ memset(pre,0,sizeof(pre)); memset(visit,0,sizeof(vis
2015-05-08 20:12:27 347
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人