-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoin Combinations II.cpp
More file actions
45 lines (38 loc) · 901 Bytes
/
Copy pathCoin Combinations II.cpp
File metadata and controls
45 lines (38 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<iostream>
#include<vector>
#include<random>
#include<chrono>
#include<algorithm>
#define SPEED ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define oo 1000000001
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define ll long long
#define ull unsigned long long
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int sz = 110, MAX = 1e7, mod = 1e9 + 7;
#define int ll
int n, x;
int c[sz];
int dp[MAX];
signed main(){
SPEED;
cin >> n >> x;
for(register int i = 1; i <= n; ++i){
cin >> c[i];
}
n = unique(c+1, c+n+1) - c - 1;
dp[0] = 1;
for(register int i = 1; i <= n; ++i){
for(register int j = c[i]; j <= x; ++j){
dp[j] += dp[j - c[i]];
dp[j] %= mod;
}
}
cout << dp[x] % mod << '\n';
return 0;
}