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…
题目链接: https://cn.vjudge.net/problem/POJ-3111 题目大意: 卖宝救夫:Demy要卖珠宝,n件分别价值vi 重 wi,她希望保留k件使得 最大. 解题思路: #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; const int INF = 1e7; ; int n, m; doub…
1.题意:给一共N个物品,每个物品有重量W,价值V,要你选出K个出来,使得他们的平均单位重量的价值最高 2.分析:题意为最大化平均值问题,由于每个物品的重量不同所以无法直接按单位价值贪心,但是目标值有界且能判断与最后答案的大小关系,所以用二分来做 3.代码: # include <iostream> # include <cstdio> # include <cmath> # include <algorithm> using namespace std;…
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…
Polycarp has a lot of work to do. Recently he has learned a new time management rule: "if a task takes five minutes or less, do it immediately". Polycarp likes the new rule, however he is not sure that five minutes is the optimal value. He suppo…
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…
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…
River Hopscotch Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 6697 Accepted: 2893 Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. T…
题目: Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000). His C (2 <= C <= N) cows don't like this barn layout and become…
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…
描述 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…
Dropping tests Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 15508 Accepted: 5418 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 100*sum(ai…