=============================
The 11th question is a bit more difficult. Using high school mathematics knowledge, it can be proved that for any number greater than or equal to 4, it can be expressed as the sum of two numbers, and the product of these two numbers is greater than or equal to the number. According to this inference, all numbers will eventually be broken down into such forms: A*A*A*A.... where A is 2 or 3 (because only 2 and 3 cannot be broken down further, and the remaining part must be only 2 and 3). So we can get the following code: (The answer is 486, I don't know if it's correct ^-^)
==================================
The 12th question seems relatively simple, but actually it's a bit difficult..
=============================================
13th question
[ Last edited by youxi01 on 2006-11-16 at 11:33 PM ]
The 11th question is a bit more difficult. Using high school mathematics knowledge, it can be proved that for any number greater than or equal to 4, it can be expressed as the sum of two numbers, and the product of these two numbers is greater than or equal to the number. According to this inference, all numbers will eventually be broken down into such forms: A*A*A*A.... where A is 2 or 3 (because only 2 and 3 cannot be broken down further, and the remaining part must be only 2 and 3). So we can get the following code: (The answer is 486, I don't know if it's correct ^-^)
@echo off
setlocal enabledelayedexpansion
set num=17
set /a Cnum=%num%/3
set /a Rnum=%num%%%2
set /a Tnum=0
for /l %%i in (%Rnum% 2 %Cnum%) do (
set num_=1
set /a num_tem=%num%/2-%%i*3/2
for /l %%a in (1 1 %%i) do (
set /a num_*=3)
for /l %%b in (1 1 !num_tem!) do (
set /a num_*=2)
if !num_! gtr !Tnum! set /a Tnum=!num_!
)
echo !Tnum!
pause>nul
==================================
The 12th question seems relatively simple, but actually it's a bit difficult..
@echo off
echo Detecting data........
setlocal enabledelayedexpansion
set /a num=1
set /a flag=0
for /l %%i in (2 1 10000) do (
call :test %%i
if !flag! equ 5 set /a num=%%i & goto :exit)
:exit
echo.
echo The smallest natural number is:!num!
echo.
echo Detection completed!
pause>nul
:test
set /a num=!num!*%1
for /l %%i in (1 1 5) do (
if !num:~-1! EQU 0 (set /a flag+=1 & set /a num=!num:~0,-1!) else (
set /a num=!num:~-1! & goto :eof))
=============================================
13th question
@echo off
echo Detecting data........
setlocal enabledelayedexpansion
for /l %%a in (90 1 180) do (
for /l %%b in (1 1 %%a) do (
set /a num=%%a %% %%b
if !num! EQU 0 (
set /a num=%%a/%%b
set /a num_=!num!+%%a+%%b
if !num_! EQU 181 echo There are such numbers, dividend: %%a divisor: %%b quotient:!num!
)
)
)
echo.
echo Detection completed!
pause>nul
[ Last edited by youxi01 on 2006-11-16 at 11:33 PM ]

DigestI