hdu 1.3.1 FatMouse' Trade】的更多相关文章

贪心的运用,主要看其比值,取最大值实现贪心... #include<cstdio> #include<algorithm> #include<vector> using namespace std; struct room { int j; int f; bool operator < (const room t)const { return (float)j/f >(float)t.j/t.f; } }; int main() { //freopen(&q…
传送门: 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): 93676    Accepted Submission(s): 32566 Problem Description FatMouse prepared M…
传送门: 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…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43381    Accepted Submission(s): 14499 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats gu…
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…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 42953    Accepted Submission(s): 14336 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
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 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 63198 Accepted Submission(s): 21342 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guardin…
解题思路:一只老鼠共有m的猫粮,给出n个房间,每一间房间可以用f[i]的猫粮换取w[i]的豆,问老鼠最多能够获得豆的数量 sum 即每一间房间的豆的单价为v[i]=f[i]/w[i],要想买到最多的豆,一定是先买最便宜的,再买第二便宜的,再买第三便宜的 -----m的值为0的时候求得的sum即为最大值   所以先将v[i]从小到大排序.   FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45213    Accepted Submission(s): 15137 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats gu…