Think:
1桶思想
2反思:心态不稳,数组越界
3题意:n件物品,每件物品价值vali,每件物品库存cnti,for any goods sold on day i, if its direct benefit is val, the total benefit would be i⋅val.
company
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
There are n kinds of goods in the company, with each of them has a inventory of and direct unit benefit . Now you find due to price changes, for any goods sold on day i, if its direct benefit is val, the total benefit would be i⋅val.
Beginning from the first day, you can and must sell only one good per day until you can’t or don’t want to do so. If you are allowed to leave some goods unsold, what’s the max total benefit you can get in the end?
Input
The first line contains an integers n(1≤n≤1000).
The second line contains n integers val1,val2,..,valn(−100≤.≤100).
The third line contains n integers cnt1,cnt2,..,cntn(1≤≤100).
Output
Output an integer in a single line, indicating the max total benefit.