本帖最后由 523066680 于 2019-3-17 12:58 编辑
回复 35# ahighhand
26选3
组合- @echo off
- call :func "abcdefghijklmnopqrstuvwxyz" "" 0
- pause &exit
-
- :func
- setlocal
- set /a v=%3
- if %v% equ 3 (echo %~2 &goto :eof)
- if %1 == "" (goto :eof)
- set strnow=%~1
- call :func "%strnow:~1%" "%~2%strnow:~0,1%" %v%+1
- call :func "%strnow:~1%" "%~2" %v%
- endlocal
复制代码 排列- @echo off &setlocal enabledelayedexpansion
- set alphabet=abcdefghijklmnopqrstuvwxyz
- for /l %%a in (0,1,25) do set eles=!eles! !alphabet:~%%a,1!
- call :func "%eles%" "" 0
- pause &exit
-
- :func
- setlocal
- set /a v=%3
- if %v% equ 3 ( echo %~2 &goto :eof)
- set eles=%~1
- for %%a in ( %eles% ) do call :func "!eles:%%a=!" "%~2%%a" %v%+1
- endlocal
复制代码
|