Start: May, 25, 2022 18:00:00
2022春acm通识课期末考补题
End: May, 25, 2025 22:00:00
Contest is nearly the end!
Time elapsed: 25150:33:08
Time remaining: 1157:26:52

tententen吃中饭

Time Limit:  1 s      Memory Limit:   256 MB
Submission:150     AC:55     Score:0

Description

又到了吃中饭的时间,tententen大宝贝想要吃得开开心心的。
已知tententen的肚子空间容量为W,餐桌上有n种食物,每种食物都有且只有一份。对于第i种食物,能使tententen开心值增加v_i,并占用她的肚子容量w_i (tententen坚持光盘行动,选了一种食物就一定会吃光)
现在,请你帮助tententen挑选食物,使得她尽可能得开心。
输出tententen总开心值的最大值

Input

第一行给定两个数字n,W。其中n为餐桌上的食物种类数,W为tententen的肚子空间容量。(1 \leqslant n \leqslant 1000,1 \leqslant W \leqslant 3000)
接下来n行,分别给出第i种食物的w_iv_iw_i为占用空间,v_i为开心值
(1 \leqslant w_i,v_i \leqslant 200)

Output

输出一个正整数,代表tententen能达到的最大开心值。

Samples

input
2 10 7 99 6 98
output
99
input
3 13 7 99 6 98 8 144
output
197

Hint

一定要让tententen吃得最开心才行噢!!!也不能把她撑坏啦