还是我来抛个砖- @echo off&setlocal enabledelayedexpansion
- set /a $=2000,#A=1,#B=2,#C=3,#D=5,#E=8
- set /a A=12*63+10000,B=#B*12*66+10000,C=#C*12*69+10000,D=#D*12*75+10000,E=#E*12*84+10000
- for /l %%a in (0 1 20) do (
- if %%a lss 19 (
- for /l %%b in (0 2 20) do (
- set /a N=%%a+%%b
- if !N! lss 18 (
- for /l %%c in (0 3 20) do (
- set /a N=%%a+%%b+%%c
- if !N! lss 16 (
- for /l %%d in (0 5 20) do (
- set /a N=%%a+%%b+%%c+%%d
- if !N! lss 13 (
- for /l %%e in (0 8 20) do (
- set /a N=%%a+%%b+%%c+%%d+%%e
- if !N! equ 20 (
- set /a _A=%%a/#A,_B=%%b/#B,_C=%%c/#C,_D=%%d/#D,_E=%%e/#E
- set "i=!$!"
- FOR %%i in (A B C D E) do (
- for /l %%j in (1 1 !_%%i!) do (
- set /a "i*=%%i"
- set i=!i:~,-4!
- )
- )
- if !i! gtr !#! set #=!i!&set @=#A!_A! #B!_B! #C!_C! #D!_D! #E!_E!
- )
- )
- ) else if !N! equ 20 (
- set /a _A=%%a/#A,_B=%%b/#B,_C=%%c/#C,_D=%%d/#D
- set "i=!$!"
- for %%i in (A B C D) do (
- for /l %%j in (1 1 !_%%i!) do (
- set /a "i*=%%i"
- set i=!i:~,-4!
- )
- )
- if !i! gtr !#! set #=!i!&set @=#A!_A! #B!_B! #C!_C! #D!_D!
- )
- )
- ) else if !N! equ 20 (
- set /a _A=%%a/#A,_B=%%b/#B,_C=%%c/#C
- set "i=!$!"
- for %%i in (A B C) do (
- for /l %%j in (1 1 !_%%i!) do (
- set /a "i*=%%i"
- set i=!i:~,-4!
- )
- )
- if !i! gtr !#! set #=!i!&set @=#A!_A! #B!_B! #C!_C!
- )
- )
- ) else if !N! equ 20 (
- set /a _A=%%a/#A,_B=%%b/#B
- set "i=!$!"
- for %%i in (A B) do (
- for /l %%j in (1 1 !_%%i!) do (
- set /a "i*=%%i"
- set i=!i:~,-4!
- )
- )
- if !i! gtr !#! set #=!i!&set @=#A!_A! #B!_B!
- )
- )
-
- ) else if %%a equ 20 (
- set "i=!$!"
- for /l %%i in (1 1 20) do (
- set /a "i*=A"
- set i=!i:~,-4!
- )
- if !i! gtr !#! set #=!i!&set @=#A20
- )
- )
-
- for %%i in (!@!) do (
- set str=%%i
- if !str:~2! neq 0 for %%j in ("!str:~,2!") do set var=!var! !%%~j!年期 !str:~2!次
- )
- echo 最大值: %#%%var%
- pause
复制代码
|