本帖最后由 hanyeguxing 于 2011-5-2 22:38 编辑
- @echo off&title by Hanyeguxing QQ:515187266&set #1=1
- :start
- setlocal enabledelayedexpansion&set/pn=请输入 1 - 10 之间的自然数:
- if %n%==1 goto:end
- for /l %%a in (2,1,%n%) do (
- set a=!a!+1&set #%%a=%%a !a:~1!+1
- if %%a gtr 2 (
- set/a b=%%a-1,c=b-1&set #%%a=!#%%a! !b!+1
- for /l %%b in (2,1,!c!) do (
- set/a d=%%a-%%b
- for %%c in (!#%%b!) do for /f "tokens=1* delims=+" %%d in ("%%c") do if %%d leq !d! set #%%a=!#%%a! !d!+%%c
- )))
- :end
- for %%a in (!#%n%!) do echo;%%a
- pause&cls&endlocal&goto:start
复制代码
|