本帖最后由 terse 于 2012-3-16 22:51 编辑
推算- @echo off&setlocal enabledelayedexpansion
- set Line=15
- for /l %%i in (0 1 %Line%) do set k= !k!&set /a "var%%i_0=1,var%%i_%%i=1,_%%i=%%i-1"
- for /l %%i in (2 1 %Line%) do (
- for /l %%j in (1 1 !_%%i!) do (
- set /a "var%%i_%%j=var!_%%i!_!_%%j!+var!_%%i!_%%j"
- )
- )
- for /l %%i in (0 1 %line%) do (
- set/a "M=(Line-%%i+1)*3"
- for /l %%j in (0 1 %line%) do IF "!var%%i_%%j!" neq "" set var=!var%%i_%%j! !var!
- for %%k in (!M!) do echo !k:~-%%k!!var!&set var=
- )
- )
复制代码 计算- @echo off&setlocal enabledelayedexpansion
- set Line=15
- for /l %%i in (0 1 %Line%) do set k= !k!&set /a "_%%i=%%i-1"
- for /l %%i in (0 1 %Line%) do (
- set/a "N=1,Var=1,M=(Line-%%i+1)*3"
- for /l %%j in (0 1 !_%%i!) do (
- set /a "N=N*(%%i-%%j)/(%%j+1)"
- set Var=!var! !N!
- )
- for %%k in (!M!) do echo !k:~-%%k!!var!
- )
- pause
复制代码 再添加一个- @echo off&setlocal enabledelayedexpansion
- set Line=9
- for /l %%i in (0 1 %Line%) do set "k= !k!"&set/a "_%%i=%%i-1"
- for /l %%i in (1 1 %Line%) do (
- SET M1=1&set var=&set/a"M=(Line-%%i+1)*3"
- for /l %%j in (1 1 %%i) do set /a "N%%j=M%%j+M!_%%j!"
- for /l %%j in (1 1 %%i) do set M%%j=!N%%j!&set Var=!var! !M%%j!
- for %%k in (!M!) do echo !k:~-%%k!!var!
- )
- PAUSE
复制代码
|