Candy Store
InterviewTime limit1sMemory limit256 MB
Count the subsets of candy prices whose total is at least C for each test case, modulo 65537.
- Level
Medium4 of 10
- Topics
- Dynamic programming
- Solved
- No attempts yet
Problem
Anne likes candy and wants to buy some at the candy store in her neighborhood. She happens to have plenty of money, so she can buy as much candy as she wants. She wants to spend at least kroner on candy, and she buys at most one candy of each type.
There are many ways to spend at least kroner, so Anne wants to know how many before she buys anything. Her parents think she is too young to use a computer, so she asked you to write a program that counts the ways for her.
Anne dislikes large numbers such as 1,000,000,007, so report the number of ways modulo .
Input
The first line contains the number of test cases . The first line of each test case contains the number of candy types and the least amount of money that Anne wants to spend. The second line contains space-separated integers , the price of candy type in kroner.
Output
For each test case, print on its own line the number of ways Anne can buy candy worth at least kroner, modulo .