Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <bits/stdc++.h>using namespace std;long long res = 0;void helper(int n, int k, int pre){if (n == 0){return;}int low = 0;int high = k;if (pre == -1){low = 1;}else if (pre != 0){high = k / pre;}if (n == 1){res += (high - low + 1);}for (int i = low; i <= high; i++){helper(n - 1, k, i);}}