class Solution {
const static int N=5010;
int f[N];
public:
int change(int amount, vector<int>& coins) {
f[0] = 1;
for(auto coin:coins){
for(int i=coin;i<=amount;i++) {
f[i] += f[i-coin];
}
}
return f[amount];
}
};