处理结果怎么和楼主贴图不一样- @echo off&setlocal enabledelayedexpansion
- set /p m=请输入m:
- set /p n=请输入n:
- set /a "l=m+n,p=1<<l,p-=1,l-=1,t=1<<n"
- for /l %%a in (0,1,%p%) do (
- set /a r=%%a%%t
- if !r! equ 0 if defined Gray echo !Gray!&set "Gray="
- set b=&set "c="
- set "a=%%a"
- for /l %%i in (0,1,!l!) do set/a "n=a&1,a>>=1"&set "b=!n!!b!"
- for /l %%i in (!l!,-1,1) do (
- set/a "n=%%i-1"
- for %%j in (!n!) do set /a "n=!b:~%%i,1!^^!b:~%%j,1!"
- set "c=!n!!c!"
- )
- set "Gray=!Gray! !b:~,1!!c!"
- )
- if defined Gray echo !Gray!
- pause
复制代码
|