【01】by [lxmxn]
========================================================================================
@echo off&&setlocal ENABLEDELAYEDEXPANSION
for %%a in (1 2 3 4 5 6 7 8 9) do (
for %%b in (0 1 2 3 4 5 6 7 8 9) do (
for %%c in (0 1 2 3 4 5 6 7 8 9) do (
set/a result=%%a*%%a*%%a+%%b*%%b*%%b+%%c*%%c*%%c
if "!result!"=="%%a%%b%%c" (
echo %%a%b%%c is the number of daffodils!
)
)
)
)
pause
========================================================================================
【02】by [lxmxn]
========================================================================================
========================================================================================
【03】by [youxi01]
========================================================================================
@echo off
setlocal enabledelayedexpansion
for /l %%i in (10 1 30) do (
::Clear variables
set flag=
for /l %%a in (0 1 9) do set %%a=
:: Obtaining cube and quadrilateral
set /a cube=%%i*%%i*%%i
set /a s=!cube!*%%i
if !cube! geq 1000 if !cube! lss 10000 (
if !s! geq 100000 if !s! lss 1000000 (
set num=!s!!cube!
call :test !num!
if not defined flag echo %%i !num!
)
)
)
pause>nul
:test
for /l %%a in (0 1 9) do (
set var=%1
:: Assign the first number of the parameter to var_; check whether the variable value!var_! has been defined as a variable.
set var_=!var:~%%a,1!
if defined !var_! set flag=1 & goto :eof
set !var_!=A
)
========================================================================================
【04】by [youxi01]
========================================================================================
@echo off
set /a t_num=0
setlocal enabledelayedexpansion
echo is detecting data...
for /l %%i in (1 1 4889) do (
if !t_num! lss 4889 (
if %%i lss 10 set /a t_num+=1
if %%i geq 10 if %%i lss 100 set /a t_num+=2
if %%i geq 100 if %%i lss 1000 set /a t_num+=3
if %%i geq 1000 set /a t_num+=4
) else set /a num=%%i-1 & goto :exit
)
:exit
The number required by echo is: %num%
pause>nul
========================================================================================
【05】by [youxi01]
========================================================================================
@echo off
set /a F_num=23
set /a J_num=60/4
setlocal enabledelayedexpansion
for /l %%i in (1 1 %J_num%) do (
set /a S_num=%%i
set /a B_num=%J_num%-%%i
set /a num=!S_num!+2*!B_num!
call :test !num! !S_num! !B_num!
)
pause>nul
:test
if %1 EQU %F_num% echo The possible combination is: number of single peaks = %2 number of double peaks = %3
goto :eof
========================================================================================
Previous page1234Next pageRead the full text