远端评测题 1000ms 125MiB

【深基12.例1】部分背包问题

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Description

Alibaba walked into a treasure cave full of treasures. In the cave, there are N(N100)N(N \le 100) piles of gold coins. For the ii-th pile, the total weight and total value are mi,vi(1mi,vi100)m_i,v_i(1\le m_i,v_i \le 100). Alibaba has a knapsack with capacity T(T1000)T(T \le 1000), but it may not be possible to pack all the gold coins. He wants to take away gold coins with as much total value as possible. All gold coins can be divided freely, and after dividing, the value-to-weight ratio (i.e., the unit price) stays the same. Find the maximum total value of gold coins that Alibaba can take away.

Input Format

The first line contains two integers N,TN, T.

The next NN lines each contain two integers mi,vim_i, v_i.

Output Format

Output one real number as the answer, printed to two decimal places.

4 50
10 60
20 100
25 100
15 45

240.00

Hint

Translated by ChatGPT 5

第 25 课:贪心算法

未认领
状态
已结束
题目
21
开始时间
2026-7-7 19:00
截止时间
2026-7-14 19:00
可延期
24 小时