|
|
楼主 |
发表于 2009-11-20 00:16:14
|
显示全部楼层
本人的解
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (a.txt) do (
- set /a hang+=1,lie=0
- for %%b in (%%a) do (
- set /a lie+=1&set "str=%%b"
- if not defined fj if "!str:~,1!" equ "当" set /a fj=lie
- if !hang! equ 1 (
- if !lie! neq 1 set "_!lie!=%%b#:"
- ) else (
- if !lie! equ 1 (
- set "ju=%%b"
- ) else (
- for %%c in (!lie!) do (
- if %%c lss !fj! (
- set /a num_%%c+=%%b
- if !str! equ 0 set "_%%c=!_%%c!!ju!,"
- ) else (
- if not defined %%c_%%b (
- set "%%c_%%b=!ju!%%b,"
- ) else (
- set "%%c_%%b=!%%c_%%b!!ju!%%b,"
- )
- )
- )
- )
- )
- )
- )
- cd.>b.txt
- for /l %%a in (2,1,%lie%) do (
- set "str=!_%%a!"
- if %%a lss %fj% (
- for %%b in (!num_%%a!) do (
- if "!str:~-1!" neq ":" (
- set "str=!str:~,-1!"&echo !str:#=%%b,完成为0的局!>>b.txt
- ) else (
- echo !str:#=%%b,完成为0的局!无>>b.txt
- )
- )
- ) else (
- for /l %%b in (1,1,%hang%) do if defined %%a_%%b set "str=!str! !%%a_%%b!"
- set "str=!str:#=!"&echo !str:~,-1!>>b.txt
- )
- )
- start b.txt
复制代码
[ 本帖最后由 batman 于 2009-11-21 11:57 编辑 ] |
|