You are viewing a single comment's thread. Return to all comments →
-c++ code
int rec(int n,vector&c) { int s=c.size(); vectorway(n+1,0); way[0]=1;
for(int i=0;i<s;i++){ int coin=c[i]; for(int j=coin;j<=n;j++){ way[j]+=way[j-coin]; } } return way[n];
}
signed main() { // memset(dp, -1, sizeof(dp)); int n,m; cin >> n>>m; vectorv(m); for(int i=0;i>v[i]; int ans=rec(n,v); cout<
return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
The Coin Change Problem
You are viewing a single comment's thread. Return to all comments →
-c++ code
int rec(int n,vector&c) { int s=c.size(); vectorway(n+1,0); way[0]=1;
}
signed main() { // memset(dp, -1, sizeof(dp)); int n,m; cin >> n>>m; vectorv(m); for(int i=0;i>v[i]; int ans=rec(n,v); cout<
}