class Solution {
public:
long long f[1010];//f[i]表示总和为i的选法个数
int combinationSum4(vector<int>& nums, int target) {
int n=nums.size();
f[0]=1;
for(int i=0;i<=target;i++)
for(int j=0;j<n;j++)
if(i>=nums[j])
f[i]=(f[i]+f[i-nums[j]])%INT_MAX;
return f[target];
}
};
标签:leetcode377,nums,int,long,IV,target,总和
From: https://www.cnblogs.com/tangxibomb/p/17349727.html