report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Coins 2 - MarisaOJ: Marisa Online Judge

Coins 2

Time limit: 1000 ms
Memory limit: 256 MB
There are $n$ types of coins in Gensokyo. The $i^{th}$ type is worth $A_i$. Marisa has to pay a debt of $k$, how many **ordered** ways of choosing coins to produce $k$? ### Input - The first line contains 2 integers $n, k$. - The second line contains $n$ distinct integers $A_i$. It is guaranteed that no 2 coin types worth the same. ### Output - Print one integer, the number of ways modulo $10^9+7$. ### Constraints - $1 \le n \le 1000$. - $1 \le k \le 10^5$. - $1 \le A_i \le 10^5$. ### Example Input: ``` 3 4 1 2 3 ``` Output: ``` 4 ``` Note: There are $4$ ways: - $1 + 1 + 1 + 1$ - $1 + 1 + 2$ - $1 + 3$ - $2 + 2$
Introduction to Dynamic Programming (Part two)
Sake game
Coins
Coins 2
Game on array
Longest increasing subsequence 2
Convolution
Regular bracket sequence
Faulty addition
Weird bank
Delete operation
Palindromize
Color ribbon
Unique subsequences
Unique subsequences 2
Cow exhibition
Knapsack 3
Compressing array
Regular bracket sequence 2
Maximum path 3
Concating substring
Soil
Stacking boxes
String transformation
Palindromic quadruple
Finding teammates
Topic
Dynamic Programming
Rating 1000
Solution (0) Solution