303124: CF609A. USB Flash Drives
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
USB Flash Drives
题意翻译
Sean正在把一个大文件考到n个U盘里。这个文件足有m MB那么大。第i个U盘的容量是a[i]。 假设Sean能把文件分装到多个U盘中,请求出他最少需要用多少个U盘来考这个文件。 ### 输入输出格式 #### 输入格式 第一行包括一个整数n(1<=n<=100)-U盘的个数。 第二行包含一个整数m(1<=m<=10^5)-文件的大小。 以下n行每一行包括一个整数a[i] (1<=a[i]<=1000)-第i个U盘的大小。 确定答案出现-也就是说所有a[i]的总和不小于m。 #### 输出格式 输出至少要多少U盘。 翻译提供者:sunhaina061031题目描述
Sean is trying to save a large file to a USB flash drive. He has $ n $ USB flash drives with capacities equal to $ a_{1},a_{2},...,a_{n} $ megabytes. The file size is equal to $ m $ megabytes. Find the minimum number of USB flash drives needed to write Sean's file, if he can split the file between drives.输入输出格式
输入格式
The first line contains positive integer $ n $ ( $ 1<=n<=100 $ ) — the number of USB flash drives. The second line contains positive integer $ m $ ( $ 1<=m<=10^{5} $ ) — the size of Sean's file. Each of the next $ n $ lines contains positive integer $ a_{i} $ ( $ 1<=a_{i}<=1000 $ ) — the sizes of USB flash drives in megabytes. It is guaranteed that the answer exists, i. e. the sum of all $ a_{i} $ is not less than $ m $ .
输出格式
Print the minimum number of USB flash drives to write Sean's file, if he can split the file between drives.
输入输出样例
输入样例 #1
3
5
2
1
3
输出样例 #1
2
输入样例 #2
3
6
2
3
2
输出样例 #2
3
输入样例 #3
2
5
5
10
输出样例 #3
1