• [1497] Take More Sugars

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There are N sugars.Each piece of sugar has a weight Ni.10 is Greedy.He wanted him to be able to hold as much sugar.But,He can only take M weight things.Help him to find out the number of sugar he can hold.
  • 输入
  • The input contains several test cases. Each test case starts with a line contains two numbers N and M(2<=N<=1000,2<=M<=500),The second line contains N integers.
  • 输出
  • For each case,output the number of sugar .
  • 样例输入
  • 2 6
    1 2
    5 12
    5 2 4 3 2
  • 样例输出
  • 2
    4
  • 提示
  • 来源
  • 大胖
  • 操作

显示春菜