Advertisement
Babul_420

gg

May 31st, 2020
1,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. for(int i=1;i<=n;i++){
  2.     for(int j=0;j<=w;j++){
  3.         if(j==0 ) totalway[i][j]=1;
  4.         else if(coins[i]>j) totalway[i][j]= totalway[i-1][j];
  5.         else totalway[i][j]= totalway[i-1][j]+ totalway[i][j-coins[i]];
  6.     }
  7.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement