描述 http://poj.org/problem?id=3111 n个珠宝,第i个有价值v[i]和重量w[i],要从总选k个,使得这k个的(价值之和)/(重量之和)即平均价值最大,输出选中的珠宝编号. K Best Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 8189 Accepted: 2087 Case Time Limit: 2000MS Special Judge Description Demy h…
Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Given your test scores and a positive integer k, determine how high you can make your cumulative averag…
1.题意:给一共N个物品,每个物品有重量W,价值V,要你选出K个出来,使得他们的平均单位重量的价值最高 2.分析:题意为最大化平均值问题,由于每个物品的重量不同所以无法直接按单位价值贪心,但是目标值有界且能判断与最后答案的大小关系,所以用二分来做 3.代码: # include <iostream> # include <cstdio> # include <cmath> # include <algorithm> using namespace std;…
描述 http://poj.org/problem?id=2456 有n个小屋,线性排列在不同位置,m头牛,每头牛占据一个小屋,求最近的两头牛之间距离的最大值. Aggressive cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10095 Accepted: 4997 Description Farmer John has built a new long barn, with N (2 <= N <=…
Dropping tests Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11367 Accepted: 3962 Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . Give…
TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 13262 Accepted: 6412 Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away w…
Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be . . Given your test scores and a positive integer k, determine how high you can make your cumulative aver…
Description Demy has n jewels. Each of her jewels has some value vi and weight wi. Since her husband John got broke after recent financial crises, Demy has decided to sell some jewels. She has decided that she would keep k best jewels for herself. Sh…
题目链接:http://poj.org/problem?id=2976 Dropping tests Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17838 Accepted: 6186 Description In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumula…