FatMouse' Trade_贪心】的更多相关文章

Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds…
FatMouse' Trade Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requ…
FatMouse' Trade 点我挑战题目 题意分析 每组数据,给出有的猫粮m与房间数n,接着有n行,分别是这个房间存放的食物和所需要的猫粮.求这组数据能保证的最大的食物是多少? (可以不完全保证这个房间的食物,及食物和猫粮可以同时乘a%) 经典的贪心策略. 先保证性价比最高的房间(花较少的猫粮可以保证最多的粮食),每组数据计算一个比率rate = 房间存放的粮食/所需要的猫粮,按照rate对其进行降序排列,优先满足上方的房间即可. 代码纵览 /* Title:HDOJ.1009 Author…
贪心思路:按单位猫粮能兑换到的javaBean从大到小将组合进行排序,总是在当前兑换尽可能多的javabeans 问题描述:点击打开链接 hdoj1009 FatMouse's Trade 源代码: #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <iostream> #include <algorithm> using…
得之我幸,不得,我命.仅此而已. 学姐说呀,希望下次看到你的时候依然潇洒如故.(笑~) 我就是这么潇洒~哈哈. 感觉大家比我还紧张~ 我很好的.真的 ------------------------------------------------------分割线:"我真的很好啦"------------------------------------------------------ 传送门:http://acm.zju.edu.cn/onlinejudge/showProblem…
#include <iostream> #include <stdio.h> #include <cstring> #include <cmath> #include <algorithm> using namespace std; struct node { double J; // JavaBean double F; // Food double rate; // 性价比 }arr[]; bool cmp(node a, node b) {…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1009 FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 92493    Accepted Submission(s): 32082 Problem Description FatMouse prepared M…
Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pound…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36632    Accepted Submission(s): 12064 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats gu…
题目地址:http://ac.jobdu.com/problem.php?pid=1433 题目描述: FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of J…