K Best Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 10507 Accepted: 2709 Case Time Limit: 2000MS Special Judge Description Demy has n jewels. Each of her jewels has some value vi and weight wi. Since her husband John got broke aft…
K Best Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 9876 Accepted: 2535 Case Time Limit: 2000MS Special Judge Description Demy has n jewels. Each of her jewels has some value vi and weight wi. Since her husband John got broke afte…
K Best Time Limit: 8000MS Memory Limit: 65536K Total Submissions: 12812 Accepted: 3290 Case Time Limit: 2000MS Special Judge Description Demy has n jewels. Each of her jewels has some value vi and weight wi. Since her husband John got broke aft…
1.题意:给一共N个物品,每个物品有重量W,价值V,要你选出K个出来,使得他们的平均单位重量的价值最高 2.分析:题意为最大化平均值问题,由于每个物品的重量不同所以无法直接按单位价值贪心,但是目标值有界且能判断与最后答案的大小关系,所以用二分来做 3.代码: # include <iostream> # include <cstdio> # include <cmath> # include <algorithm> using namespace std;…