![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
nefukadia
菜且不学
展开
-
动态维护最大值--守望者的逃离
洛谷P1095 本来是DP的一个题目,不过也可以用动态维护的方法做。 一秒一次循环,每次循环s1,s2。s2表示只是用闪现能到达的距离,s1是这个时间能达到的最远距离,每次s1+17(走路),再用s2更新s1。 #include <bits/stdc++.h> using namespace std; int main() { int m,s,t; scanf("%d%d%d",&m,&s,&t); int time=0,s1=0,s2=0;原创 2020-05-09 14:58:20 · 284 阅读 · 0 评论 -
区间贪心题目:区间覆盖&覆盖的区域长度
区间覆盖 传送门:山东理工2074 #include <bits/stdc++.h> using namespace std; int main() { int n,m; int line[205]; while(cin >> n >> m) { memset(line,0,sizeof(line)); ...原创 2020-04-15 00:20:04 · 314 阅读 · 0 评论