第4题 | @echo off | | :: 3个连续自然数的和为n-1+n+n+1= 3n | | :: 5个连续自然数的和为5n | | :: 7个连续自然数的和为7n | | :: 8个连续自然数的和为或者8n mod 4 | | | | for /l %%i in (1,1,10000) do ( | | set /a "1/!(!(%%i %% 3) & !(%%i %% 5) & !(%%i %% 7) & !((%%i-4) %% 8) )" 2> nul || ( | | echo %%i | | set /a "t3=%%i / 3, t5=%%i / 5, t7=%%i / 7, t8=(%%i-4) / 8" | | goto :end | | ) | | ) | | :end | | | | call :abc %t3% 3 t3 | | call :abc %t5% 5 t5 | | call :abc %t7% 7 t7 | | call :abc %t8% 8 t8 | | set _ | | pause | | goto :eof | | :abc | | set /a "x=%2/2, start=%1-x, end=%1+x" | | for /l %%i in (%start%, 1, %end%) do call set _%3=%%_%3%% %%i | | goto :eofCOPY |
|