![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
YMLFLONG
喜欢算法的蒟蒻
展开
-
hdu 5821 2016多校8
题意:给出连个1000的数字序列,问是否可以将第一个序列变成第二个序列。操作是将[li,ri]的数字重新排列。 题解:贪心题,先处理出来每个数字通过变化到达的位置(发现是一个区间)。然后贪心就可以了。 #include #include #include #include using namespace std; #define N 1010 //#define mp(x,y) make_p原创 2016-08-11 19:44:10 · 330 阅读 · 0 评论 -
codeforces 703C
题意:有一辆汽车从马路上穿过(不会让人的,可以看成凸多边形),一个人从马路这头最快要多久可以走到对面。速度不能超过一定值,不能被撞。 题解:贪心。过马路无非两种情况,(1)在凸多边形的每个点到达马路上之前通过这个点(全部可以的话就急速通过)。每个点走过之后再急速穿过。 #include using namespace std; typedef pair pdd; #define原创 2016-08-13 16:24:26 · 274 阅读 · 0 评论