Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- const int INF = 1e9;
- const int mod = 1e9 + 7;
- const int N = 1e6 + 5;
- int dp[N];
- signed main()
- {
- int n , x;
- cin >> n >> x;
- int a[n + 5];
- for(int i = 0; i < n; i++){
- cin >> a[i];
- }
- dp[0] = 1;
- for(int i = 1; i <= x; i++){
- for(int j = 0; j < n; j++){
- if(i >= a[j])
- dp[i] += dp[i - a[j]];
- dp[i] %= mod;
- }
- }
- cout << dp[x] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement