Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int i=1;i<=n;i++){
- for(int j=0;j<=w;j++){
- if(j==0 ) totalway[i][j]=1;
- else if(coins[i]>j) totalway[i][j]= totalway[i-1][j];
- else totalway[i][j]= totalway[i-1][j]+ totalway[i][j-coins[i]];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement