panda951 当前离线
上等兵
评分人数
pcl_test 当前离线
荣誉版主
@echo off set /p n1=user insert num1: set /p n2=user insert num2: set /a r=%n2%-1 set t=0 :main setlocal enabledelayedexpansion for /l %%a in (1 1 %n1%) do ( set "s=!s!%%a" set /a t+=1 ) if !t! geq !n2! (set str=!s!) else goto main for /l %%a in (1 1 %n2%) do set str=!str:~,%%a! & echo !str! &set str=!s! for /l %%b in (%r% -1 1) do set str=!str:~,%%b! & echo !str! &set str=!s! pause复制代码
TOP
luo0527 当前离线
三级士官
bailong360 (zhonghua)当前离线
上尉
@Echo Off SetLocal EnableDelayedExpansion Set /P Num1=user insert num1: Set /P Num2=user insert num2: For /L %%i In (1 1 %Num2%) Do ( Set N=0 For /L %%j In (1 1 %%i) Do ( If "!N!"=="3" (Set N=1) Else Set /A N+=1 Set .%%i=!.%%i!!N! ) Echo !.%%i! ) Set /A Num2-=1 For /L %%i In (%Num2% -1 1) Do Echo !.%%i!复制代码
cobat 当前离线
@echo off&setlocal enabledelayedexpansion set /p n1=user insert num1: set /p n2=user insert num2: :loop for /l %%a in (1,1,%n1%) do set "s=!s!%%a" if "!s:~%n2%!" equ "" goto :loop for /l %%a in (1,1,%n2%) do echo !s:~,%%a! set/a n2-=1&for /l %%a in (!n2!,-1,1) do echo !s:~,%%a! pause复制代码
愤怒的CMD 当前离线
我也来一个 bailong360 发表于 2015-3-23 23:06
@Echo Off SetLocal EnableDelayedExpansion Set /P Num=user insert Num: For /L %%i In (1 1 %Num%) Do ( Set N=0 For /L %%j In (1 1 %%i) Do ( If "!N!"=="%Num%" (Set N=1) Else Set /A N+=1 Set .%%i=!.%%i!!N! ) Echo !.%%i! ) Set /A Num-=1 For /L %%i In (%Num% -1 1) Do Echo !.%%i! pause>nul复制代码
@Echo Off 2>nul 3>nul SetLocal EnableDelayedExpansion Set /P Num1=user insert num1: Set /P Num2=user insert num2: For /L %%i In (1 1 %Num2%) Do Set /A "1/(N-Num1)"&&Set /A N+=1||Set N=1&Set ..=!..!!N! For /L %%i In (%Num2% -1 -%Num2%) Do For /F "Delims=-" %%j In ("%%i") Do Set /A "1/%%i"&&Echo;!..:~0,-%%j!||Echo !..! Pause复制代码