Lang:G++
Edit123456789101112131415161718192021222324252627282930#include <stdio.h>#include <string.h>#include <algorithm>#include <iostream>using namespace std;bool used[10] = { false };int len;char s[10];int n, k;char result[10] = {0};void dfs(int t, int loc) {result[loc] = t+'0';if (loc == n- 1) {printf("%s\n", result);return;}for (int i = 0; i <= 9; i++) {if (t*i <= k && i <= k)dfs(i, loc + 1);}return;}int main() {cin >> n >> k;for (int i = 1; i <= 9; i++){if(i <= k)dfs(i, 0);}return 0;}