#P2707. Facer 帮父亲
Facer 帮父亲
Description
Facer's father is a manager and is now always dejected.
Facer asked his father, what's wrong? His father said, the company has a problem.
The company manages scenic spots, each of which has many visitors.
But now, people complain that the ticket prices are too high, so he has to adjust the prices.
Specifically, for the -th scenic spot, if the ticket price is , the number of visitors is .
You need to assign the ticket price for each scenic spot such that the sum of ticket prices over all scenic spots does not exceed , and find the maximum revenue.
Input Format
The first line contains two integers .
Then follow lines, each containing two integers .
Output Format
One line, indicating the maximum revenue.
2 4
50 2
40 1
171
Hint
Sample explanation:
Scenic spot ticket price is , scenic spot ticket price is .
Scenic spot visitors: , revenue: .
Scenic spot visitors: , revenue: .
The total revenue is .
- For of the testdata, , .
- For of the testdata, , .
- For of the testdata, , .
- For of the testdata, , , .
Thanks to zhouyonglong for providing the solution.
Translated by ChatGPT 5
京公网安备 11011102002149号