贪心法
旻宇
New Acmer
展开
-
HOJ1941 超市收银问题
L最近在工大外面开了一个小超市。由于该超市物美价廉,且服务态度热情,因此刚开业就十分火爆。可是,这个超市目前只有两个收银台,以至于最近经常有顾客抱怨等待交款的时间太长。 这个超市目前暂时没有办法增加新的收银台,因此,L想通过别的办法缓解这个问题。现在,假设有N个顾客在等待交款。显然,前两个顾客可以马上得到服务,而后面的就得排队等候。L想重新调整一下两支队伍,使得这N个顾客们的平均等待时间最小。假原创 2014-07-16 21:51:05 · 1437 阅读 · 0 评论 -
hdu2187 悼念512汶川大地震遇难同胞——老人是真饿了
贪心法水题,代码如下: #include #include struct rice{ int p, w; }r[1010]; bool cmp(rice x, rice y){ return x.p } int main(){ int c, n, i, t, m; double ans; scanf("%d原创 2014-07-16 22:43:47 · 521 阅读 · 0 评论 -
POJ1323 Game Prediction
Description Suppose there are M people, including you, playing a special card game. At the beginning, each player receives N cards. The pip of a card is a positive integer which is at most N*M. And原创 2014-07-16 20:58:38 · 530 阅读 · 0 评论 -
POJ2287/UVA1344 Tian Ji -- The Horse Racing
Description Here is a famous story in Chinese history. That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.原创 2014-05-18 17:27:58 · 628 阅读 · 0 评论 -
poj1065 Wooden Sticks
Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17946 Accepted: 7516 Description There is a pile of n wooden sticks. The length and weight of e原创 2014-06-20 21:14:23 · 561 阅读 · 0 评论 -
poj1477 Box of Bricks
在OJ题目分类的网页上找到这个题原创 2014-06-20 17:54:41 · 498 阅读 · 0 评论 -
POJ2662 A Walk Through the Forest
URL: http://poj.org/problem?id=2662v原创 2014-07-14 13:52:26 · 528 阅读 · 0 评论 -
POJ1716 Integer Intervals
URL: http://poj.org/problem?id=1716原创 2014-07-13 22:27:14 · 460 阅读 · 0 评论 -
LeetCode Best Time to Buy and Sell Stock 系列
121 Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy原创 2015-05-02 22:55:28 · 444 阅读 · 0 评论