摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2203 思路: Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断 阅读全文
posted @ 2016-08-03 23:21 weeping 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 思路: 简单模拟下。从左向右扫描一次,求出挖出该区间空地的花费,并取个最小值即可。 至于怎么求区间内的高度最小值,就用线段树就好了。 阅读全文
posted @ 2016-08-03 23:05 weeping 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 思路:1.把所有有长度的剑看做点。Ai点是肯定要取。然后求另一把剑。 先对右区间排个序,然后每次看这个区间范围内有没有剑,如果没有就添加一把(值为右端点的剑); 如果有并且数量为1且这条龙的Ai等这把剑的长度的话,说用还需要一把剑,再添加一把。 否则不添加。 至于怎么查询某个区间有没有剑,可以用树状 阅读全文
posted @ 2016-08-03 23:02 weeping 阅读(541) 评论(0) 推荐(0) 编辑
摘要: 思路:排个序,依次选就好了。 阅读全文
posted @ 2016-08-03 22:53 weeping 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3746 题目: Problem Description CC always becomes very depressed at the end of this month, he has checked 阅读全文
posted @ 2016-08-03 22:49 weeping 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1686 题目: Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparit 阅读全文
posted @ 2016-08-02 22:56 weeping 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1711 题目: Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2] 阅读全文
posted @ 2016-08-02 22:42 weeping 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 呃,从网上看的题解,然而其实有点地方还没搞懂,先放在这,以后再回来理解。 题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4749 题目:2013 is the 60 anniversary of Nanjing University of Scienc 阅读全文
posted @ 2016-08-02 22:21 weeping 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 前面两份代码其实并不是真的nlogn级别的,因为在合并时枚举的点的个数并不是6个点,真正的分治法只需枚举六个点就可以。所以前两份代码容易被卡时间!!!这是我在比赛时wa了21发得到的血的教训!!! 阅读全文
posted @ 2016-07-28 14:48 weeping 阅读(2707) 评论(3) 推荐(0) 编辑
摘要: #include #include #include using namespace std; const int N=110; int dfn[N],low[N],head[N],vis[N]; bool cut[N]; int k,n,cnt,root; struct Edge{ int to,nxt; }edge[N1) || (u!=root && dfn[u]<=low... 阅读全文
posted @ 2016-07-26 00:47 weeping 阅读(114) 评论(0) 推荐(0) 编辑
摘要: #include #define PB push_back #define MP make_pair using namespace std; typedef long long LL; typedef pair PII; #define PI acos((double)-1) #define E exp(double(1)) #define K 100000+9 int a[K],vis[K... 阅读全文
posted @ 2016-07-24 11:27 weeping 阅读(396) 评论(0) 推荐(0) 编辑
摘要: LL gcd(LL a,LL b){ if(b==0) return a; else return gcd(b,a%b); } LL ex_gcd(LL a,LL b,LL &x,LL &y){ if(b==0){ x=1;y=0; return a; } LL r=ex_gcd(b,a%b,x,y); LL t=... 阅读全文
posted @ 2016-07-24 09:24 weeping 阅读(251) 评论(0) 推荐(0) 编辑
摘要: /**************************************************** 二分图匹配(匈牙利算法的DFS实现) INIT:g[][]两边定点划分的情况 CALL:res=hungary();输出最大匹配数 优点:适于稠密图,DFS找增广路快,实现简洁易于理解 时间复杂度:O(VE); ***************************************... 阅读全文
posted @ 2016-07-22 23:00 weeping 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 再来一个: 其实就是快速幂的原理! 阅读全文
posted @ 2016-07-21 01:31 weeping 阅读(313) 评论(0) 推荐(0) 编辑
摘要: #include <cstdio>#include <algorithm>#include <cmath>#include <queue>#include <iostream>#include <cstring>using namespace std;#define DIGIT 4 //四位隔开,即 阅读全文
posted @ 2016-07-20 12:40 weeping 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 这是一篇讲的很好很好的博文:http://www.cnblogs.com/python27/archive/2013/09/05/3303721.html #include using namespace std; int dp[10000][10000]; int coin[]={0,1,5,10,25,50}; void fd(int x) { for(int i=0;i<=5;... 阅读全文
posted @ 2016-07-17 23:52 weeping 阅读(355) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; int dp[10000][10000]; int lcs(string str,int n){ int tmp; memset(dp,0,sizeof(dp)); for(int i=0; i>n; while(n--) { cin>>s; int x=lcs... 阅读全文
posted @ 2016-07-17 23:30 weeping 阅读(166) 评论(0) 推荐(0) 编辑
摘要: poj3259 Wormholes 阅读全文
posted @ 2016-07-16 11:59 weeping 阅读(222) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2016-07-15 16:08 weeping 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 并查集 阅读全文
posted @ 2016-07-13 23:46 weeping 阅读(109) 评论(0) 推荐(0) 编辑