贪心
文章平均质量分 56
Java_beginer1
爱好算法
展开
-
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3508 贪心
这题是比赛时的一道,比完赛后又做了好久才弄出来,打击很大;以后要更加努力了;就是先对士兵所能拿武器的最大值从小到大排序;武器从小到大排序;#include#include#include#include#includeusing namespace std; struct node { int minx,maxx; }a[2501]; bool cmp(nod原创 2012-08-02 14:53:10 · 704 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1009贪心
刚开始题意没有理解,总算理解了,今天起床有点晚了,惩罚下自己,不吃饭了;饿着肚子写的水题;题意:有n磅的cat food ,m个房间,第i个房间有J[i]磅JavaBean和F[i]磅cat food ,可以用a%的F[i],换取该房间的a%的J[i];分析:按照每个房间J[i]/F[i]自大到小排序;#include#include#includeusing nam原创 2012-08-04 10:33:50 · 551 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=2037贪心水题
尼玛被线段树完虐...暂时转战贪心#include#includeusing namespace std;paira[100];/*struct node{int first;int second;}a[100];bool cmp(node a,node b){ return a.first<b.first;}*/int main(){ int n; w原创 2012-08-08 16:53:28 · 717 阅读 · 0 评论