![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hdoj
文章平均质量分 68
Fistice
这个作者很懒,什么都没留下…
展开
-
HDU 5900 QSC and Master
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5900题意:给你多组pair,每个pair有key,value两个值,可以将相邻的 并且 key之间的公约数不唯一的两对pair 消掉(从序列中拿出),最后输出所有被拿出的pair的value的和的最大值。当两对符合条件的pair被拿出后,他们边上的另外两对也就变成相邻了。(比如有标原创 2016-10-12 20:40:28 · 247 阅读 · 0 评论 -
HDU 6053 TrickGCD
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=6053题意:给出一个长度为N的序列A,让你求有同长度的序列B一共有多少个。 * 对于每个Bi,满足1≤Bi≤Ai * 对于每对( l , r ) (1≤l≤r≤n) , gcd(bl,bl+1…br)≥2 分析: 一开始我就想跟素数有关,所以我与处理了1e5内的素数表。 先比如对于一个数p(你原创 2017-07-27 21:13:23 · 428 阅读 · 0 评论 -
HDU 2767 Proving Equivalences(待完善)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2767 题意:给出一个有向图,问至少再连几条边可以使得该图强连通。 (最下方有强连通定义。) 分析:(看其他人博客理解了一下)将一个强连通分量看成一个点,并且继承之前不同分量所相连的边,若要该图强连通,则需要每个分量的出入度都不为0。(这个可以自己想一下证明。虽然让我主动想可能想不出。。原创 2016-10-29 10:53:06 · 345 阅读 · 0 评论 -
HDU 3572 Task Schedule
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3572 题意:给出n个任务,m个机器,第i个任务需要在一台机器上工作pi时间才能完成,而且必须要在给定的si-ei时间内完成。问是否可以完成全部任务。 分析:主要是建图。建立一个超级原点s和超级汇点t,在s与第i个任务间建立容量为pi的边,在第i个任务和si~ei的所有时间点建立容量为1的边,然后在所原创 2016-10-14 22:47:46 · 393 阅读 · 0 评论 -
HDU 3549 Flow Problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3549题意:给出一个图,1源点,N汇点,求最大流。 分析:最大流模板题。 代码:#include<bits/stdc++.h>using namespace std;const int N=20,M=1005,INF=0x3f3f3f3f;int c[N][N],dis[N],s,t;int原创 2016-10-14 18:30:44 · 222 阅读 · 0 评论 -
HDU 3496 Watch The Movie
题意:http://www.rqnoj.cn/problem/95题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3496 代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define原创 2016-10-12 20:38:55 · 195 阅读 · 0 评论 -
HDU 2059 龟兔赛跑 (dp) 代码+注释
//方程 dp[j]=min(dp[j],dp[i]+t+x/vt1+y/vt2);/*假设在第i个加油站充电,则到达第j个加油站的最优时间为dp[j].将终点设为最后一个加油站,起点设为第0个,特判起点。*/#include#include#include#include#include#include#include#include#include#include#include#define原创 2016-10-12 20:39:04 · 423 阅读 · 0 评论 -
HDU 1028 Ignatius and the Princess III
//强行递推。 xx[i][j]表示i数中第j个开头的组合种类。/*最终结果[i]为 sum of(xx[i][j]) (j from 1 to i); xx[i][j]=sum of (xx[i-j][k]) (k from 1 to j);例如 xx[10][4]=xx[6][1]+xx[6][2]+xx[6][3]+xx[6][4];xx[6][1] =1;原创 2016-10-12 20:39:09 · 345 阅读 · 0 评论 -
HDU 1270 小希的数表
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1270题意:给出N个5000以内的两两相加产生的N*(N-1)/2个数(已排好序),求那N个数。(按序输出)思路:将给出的序列称为a,N个数的序列称为b,则b1+b2=a1,b1+b3=a2,(b2+b3也存在于a序列中),所以可以通过枚举b1,得出b2,b3。将已经得出的数的和从a原创 2016-10-12 20:40:01 · 574 阅读 · 0 评论 -
HDU 5867 Water problem (2016 多校训练#10 1011)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5867题意:给一个不超过一千的数字N,求出1-N所有单词加起来的字母个数和(f(1)=len(one)=3,f(2)=f(1)+len(two)=6...)。分析:一看名字就知道是到水题了...直接打表。(保险起见,我还手打了20内的表)。 代码:#include原创 2016-10-12 20:39:44 · 216 阅读 · 0 评论 -
HDU 5858 Hard problem (2016 多校训练#10 1002)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5858题意:给出下图和正方形边长,求阴影部分面积。分析:数学题,总之就是割来割去推公式,比赛时是队友打的,拿他代码直接贴了。具体分析可以看这里。http://www.zybang.com/question/1301cb472211299680f8d4796e7dc797.原创 2016-10-12 20:39:42 · 397 阅读 · 0 评论 -
HDU 5857 Median (2016 多校训#10 1001)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5857题意:给出一个已排好的序列,再给出两个范围(l1,r1,l2,r2),求由着两个子序列 组成的新序列的中位数,结果保留一位小数。官方题解:一个数组上的两个区间求中位数,可以通过分类讨论直接找到中位数,复杂度O(1).不过本题数据较小,优美的log(n)也可过.分析:我用原创 2016-10-12 20:39:40 · 234 阅读 · 0 评论 -
HDU 4790 Just Random
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=4790 题意: 给出a,b,c,d,p,m; 在区间[a,b]之间随机选择出x,在区间[c,d]之间随机选择出y,求出现(x+y)%p==m的概率。答案用分数表现出来。 分析: 做完后神奇的发现其他人的方法跟我有些 ,, 很大的差别。貌似别人直接推的规律… 我的方法是 就原创 2017-10-03 19:29:05 · 256 阅读 · 0 评论