题目描述
Rani works at sweet shop and is currently arranging sweets i.e. putting sweets in boxes. There are some boxes which contains sweets initially but they are not full. Rani have to fill boxes completely thereby minimizing the total no. of boxes.
You are given N no. of boxes, their initial amount and total capacity in grams. You have to print out the minimum no. of boxes required to store given amount of sweets.
Input:
First line contains no. of test cases. Each test case contains N no. of boxes and next two lines contains n values each denoting their initial amount and total capacity.
Output:
Print out the minimum no. of boxes required to store given amount of sweets.
SAMPLE INPUT
2
3
300 525 110
350 600 115
6
1 200 200 199 200 200
1000 200 200 200 200 200
SAMPLE OUTPUT
2
1
Explanation
Testcase 1:
One way to pack the sweets onto as few boxes as possible is as follows. First, move 50 g from box 3 to box 1, completely filling it up. Next, move the remaining 60 g from box 3 to box 2. There are now two boxes which contain sweets after this process, so your output should be 2.
Testcase 2:
One way to consolidate the sweets would be to move the 1 g from box 1 to box 4. However, this is a poor choice, as it results in only one free box and five boxes which still contain sweets. A better decision is to move all the sweets from the other five boxes onto box 1. Now there is only one box which contains sweets. Since this is the optimal strategy, the output should be 1.
输入格式
见题面
输出格式
见题面