证明转自: here 题意:有 n 个地板,每个地板 i 有两个权值 Wi, Si,且 PDV(i) = (ΣWj) - Si ( j 表示在 i 上面的地板).问如何调整顺序,使得[max(PDV)]最小. 思路:假设i,j相邻,并且i上面的重量为sum,若i在上面,则有pi=sum-si,pj=sum+wi-sj;若j在上面,则有pi'=sum+wj-si,pj'=sum-sj; 显然有pi<pi',pj>pj',于是令pj<pi',就有sum+wi-sj<sum+wj-s…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3175 Accepted Submission(s): 1457 Problem Description Tom owns a company and he i…
http://acm.hdu.edu.cn/showproblem.php?pid=4803 话说C++还卡精度么? G++ AC C++ WA 我自己的贪心策略错了 -- 就是尽量下键,然后上键,最后下键补全,可是例子都过不了..... 题解參考http://www.cnblogs.com/xuesu/p/3967704.html http://www.cnblogs.com/Canon-CSU/p/3451784.html http://blog.csdn.net/keshuai199…
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=4296 Buildings Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1822 Accepted Submission(s): 722 Problem Description Have you ever heard the st…
http://acm.hdu.edu.cn/showproblem.php?pid=1052 Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31270 Accepted Submission(s): 9523 Problem Description Here is a fam…
解题思路:排序后贪心,和fatmouse's trade 类似 Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5837 Accepted Submission(s): 2692 Problem Description 话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了.显然,作为多年拼搏…
Steal the Treasure Time Limit: 10000/6000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 775 Accepted Submission(s): 213 Problem Description The alliance of thieves decides to steal the treasure from country A.…
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5245 Accepted Submission(s): 2397 Problem Description 话说上回讲到海东集团面临内外交困,公司的元老也仅仅剩下XHD夫妇二人了.显然,作为多年拼搏的商人,XHD不会坐以待毙的. 一天,当他正在苦思冥想解困良…
B - 贪心 基础 Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse contai…
A.GPA(HDU4802): 给你一些字符串对应的权重,求加权平均,如果是N,P不计入统计 GPA Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1193 Accepted Submission(s): 743 Problem Description In college, a student may take several…
Balala Power! Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3757 Accepted Submission(s): 907 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. H…
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3291 Accepted Submission(s): 703 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. Bu…
Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20938 Accepted: 8872 Description There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworkin…
贪心的经典题型 该死的精度问题,WA了好几次,以后能用乘的绝不用除!! #include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int n,v,w,k,i; int p[111],t[111]; cin>>k; while(k--){ cin>>n>>v>>w; for(i=0;i<n;i++)…
Too Rich Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1666 Accepted Submission(s): 422 Problem Description You are a rich person, and you think your wallet is too heavy and full now. So…