- #include <bits/stdc++.h>
- using namespace std;
- int mod = 1000000007, n;
- vector <int> dp;
- vector <int> coin;
- vector <int> visited;
- int aa(int x)
- {
- if(visited[x]) return dp[x];
- for(int i=0; i<n; i++)
- {
- if(coin[i]<=x)
- {
- dp[x] += aa(x-coin[i]);
- dp[x]%=mod;
- }
- }
- //cout << x << " " << dp[x] << endl;
- visited[x]++;
- return dp[x];
- }
- int main()
- {
- /*
- int x;
- cin >> n >> x;
- dp.resize(x);
- visited.resize(x);
- coin.resize(n);
- dp[0]++;
- visited[0]++;
- for(int i=0; i<n; i++)
- cin >> coin[i];
- cout << aa(x);
- return 0;
- */
- int n[] = {0, 1, 2, 3, 4, 5};
- int *nptr = n;
- cout << *nptr << endl;
- nptr = &n[2];
- cout << *nptr << endl;
- nptr = &n[4];
- cout << *nptr << endl;
- }
複製代碼 |