diff --git a/test b/test new file mode 100644 index 0000000..c0f9289 --- /dev/null +++ b/test @@ -0,0 +1,42 @@ +#include +#include +#include +int ans[11]; +void f(char str[], int l0, int l) { + if (l0 == l) { + for (int i = 1; i <= ans[0]; i++) { + printf("%c", str[ans[i]]); + } + printf("\n"); + return; + } + for (int i = 0; i < l0; i++) { + int flag = 1; + for (int j = 1; j <= ans[0]; j++) { + if (i == ans[j]) { + flag = 0; + break; + } + } + if (flag == 1) { + ans[++ans[0]] = i; + f(str, l0, l + 1); + ans[0]--; + } + } +} +void Cal(char* str) +{ + int len = strlen(str); + for (int i = 0; i < len - 1; i++) { + for (int j = 0; j < len - 1 - i; j++) { + int tmp; + if (str[j] > str[j + 1]) { + tmp = str[j]; + str[j] = str[j + 1]; + str[j + 1] = tmp; + } + } + } + f(str, len, 0); +} \ No newline at end of file