- @echo off
- setlocal enabledelayedexpansion
- ::第一个服务员打开所有窗户,打开为1,关上为0
- for /l %%i in (1,1,100) do (
- set /a _%%i=1
- )
-
- ::第二人关编号为2的倍数之窗。第三人操作编号为3的倍数之窗,开的关,关的开...
- for /l %%i in (2,1,100) do (
- set /a n=100 / %%i
- for /l %%j in (1,1,!n!) do (
- set /a c=%%i*%%j
- call set b=%%_!c!%%
- if !b! equ 1 (set /a _!c!=0) else set /a _!c!=1
- )
- )
- ::符合条件输出
- for /l %%i in (1,1,100) do (
- if !_%%i! equ 1 (
- set /a num+=1
- echo %%i
- )
- )
- echo !num!个窗打开的
- pause>nul
复制代码
|