Logo
(追記) (追記ここまで)

9352번 - Fundraised 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB43262560.976%

문제

Guess what?! Dalia won the money (an amount X), and now it’s time to spend it. Mohamed Fouad is the deputy regional contest director and he wants to spend the money but he doesn’t know what to spend it on. There are N items that he can buy like name-tags, T-shirts, helium balloons, trophies, etc. each having a different importance value and a cost to buy one unit from (you can buy as much units of any item as you want as long as you don't exceed the budget).

Mohamed wants your help; tell him the maximum importance value he can get after he chooses optimally to buy any number of items without exceeding his budget.

입력

The first line of input contains an integer T, the number of test cases. T test cases follow, the first line of each test case contains two integers (1 ≤ N ≤ 100), (1 ≤ X ≤ 10000). The second line of the test case contains N space separated integers Ii (1 ≤ Ii ≤ 400000), each representing the importance value Fouad earns from item i (0 ≤ i < N). The following line contains N space separated integers Ci (1 ≤ Ci ≤ 1000), each representing the cost of an item i (0 ≤ i < N).

출력

For each test case, on a separate line, output the maximum importance value Fouad can get.

제한

예제 입력 1

1
5 20
1 2 3 4 5
2 6 3 5 4

예제 출력 1

25

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > ACM Jordanian Collegiate Programming Contest > JCPC 2012 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /