試è¡é¯èª¤ãã¦ããã¨ãç°å¢å¤æ°ãå¤ãã¨é
ããªããã¨ããããã¾ããã
ã¾ããæå®ããæ°ã ãé
åãã©ãã®å¤æ°ãçæãããã®ãã¨ã«åç´ãªåãåãå¦çã«ãããæéãè¨æ¸¬ãã¾ããã
å¤æ°ã®æ° | å¦çæé |
---|---|
10 | 11.38s |
100 | 12.03s |
1000 | 15.95s |
3000 | 26.00s |
10000 | 61.27s |
30000 | 160.52s |
1000åãªãããã»ã©é
ããªãã¾ãããã10000åã ã¨ããªãé
ããªãã¾ãããã©ããããã®å¦çã§ã¯å¤æ°ãä¸ã¤å¢ãããã¨ã«5msé
ããªãããã§ããå¤æ°ã¯1000ã«è¿ããããã®æ°ã«æããã»ããããããã§ãã
@echo off setlocal set /a M = 30000 set /a a.size = %M% call :fill_vector a 0 set /a N = 10000 call :get_time set /a t = %ERRORLEVEL% call :sum %N% call :get_time set /a t = %ERRORLEVEL% - %t% echo %N% %M% %t:~0,-2%.%t:~-2%s exit /b 0 :sum set /a s = 0 set /a k = 1 :loop_sum set /a s += %k% set /a k += 1 if %k% LEQ %1 goto :loop_sum exit /b %s% :fill_vector set /a end = "%1.size" - 1 for /L %%i in (0, 1, %end%) do set /a %1_%%i = %2 exit /b 0 :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%