• [1479] How many

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There are N numbers, no repeat. All numbers are between 1 and 120, and N is no more than 60. then given a number K(1 <= K <= 100). Your task is to find out some given numbers which sum equals to K, and just tell me how many answers totally,it also means find out hwo many combinations at most.
  • 输入
  • There are T test cases.
    For each case:
    First line there is a number N, means there are N numbers.
    Second line there is a number K, means sum is K.
    Third line there lists N numbers.
    See range details in describe.
  • 输出
  • Output the number of combinations in total.
  • 样例输入
  • 2
    5
    4
    1,2,3,4,5
    5
    6
    1,2,3,4,5
    
  • 样例输出
  • 2
    3
    
  • 提示
  • For the first case: 1+3=4, 4=4.
    For the second case: Don't consider the order, that means 1+2+3=6 equals 1+3+2=6 equals 3+1+2=6, etc.
  • 来源
  • Mr.Cai
  • 操作

显示春菜