
贪心
better_space
这个作者很懒,什么都没留下…
展开
-
【杭电2124】Repair the Wall
#include<stdio.h>#include<algorithm>using namespace std;__int64 a[606];bool judge(__int64 a,__int64 b) { return a>b;}int main() { __int64 n,m; while(scanf("%I64d %I64d",&n,&m)!=EOF) {原创 2016-07-22 20:34:18 · 293 阅读 · 0 评论 -
【杭电oj1257】最少拦截系统
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34720 Accepted Submission(s): 13707Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹原创 2016-08-12 09:48:17 · 724 阅读 · 0 评论 -
【杭电oj1051】Wooden Sticks
Wooden SticksTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18623 Accepted Submission(s): 7614Problem DescriptionThere is a pile原创 2016-08-12 09:55:17 · 529 阅读 · 0 评论 -
【杭电1789】Doing Homework again
#include<stdio.h>#include<algorithm>using namespace std;struct note { int day; int score;//分数 bool mark;} s[1006];bool judge(note a,note b) { if(a.day==b.day) return a.scor原创 2016-07-22 20:37:42 · 326 阅读 · 0 评论 -
【杂】F是签到题
和田忌赛马那道类似谈心题 田忌赛马链接: http://blog.youkuaiyun.com/better_space/article/details/52013256#include<stdio.h>#include<algorithm>using namespace std;const int N = 55;int my[N];int yo[N];int main() { int原创 2016-07-30 20:03:01 · 206 阅读 · 0 评论 -
【杭电1052】Tian Ji -- The Horse Racing
应该算是贪心里的思维题,这种题没有固定的模板,选对贪心的标准就对了,本题标准就是每一步都要尽可能的为下一步的比赛创造赢的条件。#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int ti[1002],ki[1002],c[1002];int main() { int T=50;原创 2016-07-24 11:48:33 · 587 阅读 · 0 评论 -
【codeforces】Radar Installation
别说话,看注释。#include<stdio.h>//此题犯了一个超级二,又很可能被忽略而出现的问题 //输出-1的时候我竟然忘了Cace %d:格式了 / 大哭/哇/ #include<math.h>#include<algorithm>using namespace std;struct note { double front; doub原创 2016-07-23 20:06:12 · 377 阅读 · 0 评论 -
【codeforces】 Far Relative’s Problem
这不能算贪心题吧#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int a[380],m1[380],m2[380];int main() { int n; while(scanf("%d",&n)!=EOF) { int began,end;原创 2016-07-23 21:12:57 · 249 阅读 · 0 评论 -
【codeforces】Vacations
本题要考虑清楚各种情况,其实也很简单一个循环解决了,重要的还是贪心的思想。尽可能多的不休息。 ***1.遇到0,休息天数加1; 2.遇到非第0(第0个元素是三可以舍掉,不影响结果)个元素是3的,如 果前面是2,就让它等1,反之等2; 3.遇到两个1或2相等,后一个等0,休息天数加1。*#include<stdio.h>int a[102];int main() { int n;原创 2016-07-24 00:04:25 · 278 阅读 · 0 评论 -
【杭电4883】TIANKENG’s restaurant
#include<string.h>#include<stdio.h>#include<algorithm>using namespace std;int a[100000];int main() { int t; scanf("%d",&t); while(t--) { int n,i; memset(a,0,sizeof(a));原创 2016-07-22 20:41:07 · 252 阅读 · 0 评论 -
【杭电1009】FatMouse' Trade
#include<stdio.h>#include<algorithm>using namespace std;struct note { double java; double food; double ratio;} s[1001];bool judge(note a,note b) { return a.ratio>b.ratio;}int原创 2016-07-22 14:09:52 · 324 阅读 · 0 评论 -
【杭电2037】今年暑假不ac
贪心水题#include<stdio.h>#include<algorithm>using namespace std; struct note { int began; int end;} s[101];bool judge(note a,note b){ return a.end<b.end;}int main() { int n; whi原创 2016-07-22 14:32:44 · 383 阅读 · 0 评论 -
【杭电2111】Saving HDU
#include<stdio.h>#include<algorithm>using namespace std;struct note { int uprice;//unite单价 int bulk;//体积} s[102];bool judge(note a,note b) { return a.uprice>b.uprice;}int main() {原创 2016-07-22 14:36:34 · 380 阅读 · 0 评论 -
【杭电oj2021】发工资咯:)
发工资咯:)Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 51230 Accepted Submission(s): 27970Problem Description作为杭电的老师,最盼望的日子就是每原创 2016-08-12 23:43:02 · 2033 阅读 · 0 评论