![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
埙声
银子金贵,可一旦碰上命了,就如同尘土草芥一般。
展开
-
贪心买最多东西
#include #include using namespace std; struct P { double weight; double pay; }s[1000]; int cmp(P a,P b) { return a.pay/a.weight<b.pay/b.weight; } int main() { int n,i,j; double sum,m;原创 2015-01-24 17:10:24 · 509 阅读 · 0 评论 -
没天理的贪心,做不完作业怎么少挨批
#include #include #include using namespace std; struct punish { int deadline; int score; }s[1000]; int cmp(punish a,punish b) { if(a.score==b.score) return a.deadline<b.deadline;原创 2015-01-24 19:20:16 · 405 阅读 · 0 评论 -
C语言贪心看最多节目
#include #include using namespace std; struct time { int start; int stop; }s[100]; int cmp(time a,time b) { return a.stop<b.stop; } int main() { int n,i,j,m,k,p,time; while(~scanf(原创 2015-01-24 15:36:15 · 1069 阅读 · 0 评论