This is a typical dp problem. Let's crack it.

```
int combinationSum4(vector<int> &nums, int target) {
int tmp[target + 1]{1};
for (int i = 1; i <= target; ++i)for (int n:nums)if (n <= i)tmp[i] += tmp[i - n]; //the number i consists of i-n and n
return tmp[target];
}
```