é£ããåé¡ãæ¥ã¾ããã
ä¸ã¤ãã¤ç´ æ°ãã©ãããã§ãã¯ãã¦ããã°ã¨ã¦ãéã«åããªãã§ãããã
@echo off call :get_time set /a t0 = %ERRORLEVEL% set /a N = 100 set /a counter = 0 set /a m = 2 :loop call :is_prime %m% if %ERRORLEVEL% == 1 ( set /a counter += 1 ) if %counter% LSS %N% ( set /a m += 1 goto :loop ) call :get_time set /a t = %ERRORLEVEL% - %t0% echo %t:~0,-2%.%t:~-2%s echo %m% exit /b 0 :is_prime setlocal set /a n = %1 if "%2" == "" ( set /a k = 2 ) else ( set /a k = %2 ) set /a k_sq = %k% * %k% if %k_sq% GTR %n% exit /b 1 set /a r = %n% %% %k% if %r% == 0 exit /b 0 set /a next_k = %k% + 1 call :is_prime %n% %next_k% exit /b %ERRORLEVEL% :get_time setlocal set t=%TIME% set /a h = %t:~0,2% set /a m = 1%t:~3,2% %% 100 set /a s = 1%t:~6,2% %% 100 set /a ss = 1%t:~-2% %% 100 set /a ret = ((%h% * 60 + %m%) * 60 + %s%) * 100 + %ss% exit /b %ret%