解题步骤:
参考代码:
class Solution {
public:int combinationSum4(vector<int>& nums, int target) {int n=nums.size();vector<double> dp(target+1);//初始化dp[0]=1;//填表for(int i=1;i<=target;i++){for(int j=0;j<n;j++){//填表if(i>=nums[j]){dp[i]+=dp[i-nums[j]];}}}//返回值return dp[target];}
};
你学会了吗???