|
flyinspace
银牌会员
    
积分 1206
发帖 517
注册 2007-3-25
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
哎,牛人就是牛人。。。。。。
果然厉害。
Hey, The expert is indeed an expert...
Really impressive.
|

知,不觉多。不知,乃求知 |
|
2008-8-22 22:57 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
测试了下,发现是你算错了呀。我还郁闷BAT居然是微秒。
你的时间计算差了10000倍!!!。
1秒=1000毫秒=1000000微秒
I tested it and found that you made a mistake in calculation. I was still confused that BAT was actually microseconds.
Your time calculation was off by 10,000 times!!!.
1 second = 1000 milliseconds = 1,000,000 microseconds
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2008-8-23 01:55 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
希望terse讲解下算法,我没看懂
Hope to give a terse explanation of the algorithm, I didn't understand it.
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2008-8-24 14:11 |
|
|
terse
银牌会员
    
积分 2404
发帖 946
注册 2005-9-8
状态 离线
|
    『第 19 楼』:
使用 LLM 解释/回答一下
Originally posted by everest79 at 2008-8-24 14:11:
希望terse讲解下算法,我没看懂
@echo off&setlocal enabledelayedexpansion
:st
rem call 9次 %1-%9 即1-9行
for /l %%i in (1 1 9) do call:lp %%i
pause&exit
:lp
rem 每行获1-9随机数
for /l %%i in (1 1 9) do set .!random!!random!!random!=%%i
for /f "tokens=1,2 delims==" %%i in ('set .') do set str=%%j !str!&set %%i=
rem 清空出错时返回IP标签时的%1所在行的变量
for /l %%i in (1 1 9) do set %1%%i=
rem 设定列n(起始为1) v上一行行值%1-1 y-z起始列范围值 x起始行值 变量a 判断是否1 4 7行
set var=%str%&set/a n=1,v=%1-1,y=1,z=3,x=1,a=%1%%3
rem 根据%1范围值 设定 x(行号)
if %1 geq 4 if %1 leq 6 (set/a x=4) else set/a x=7
:lp0
rem 根据变量列值n值 设定y-z列范围值
if %n% geq 4 if %n% leq 6 (set/a y=4,z=6) else set/a y=7,z=9
for %%a in (!var!) do (
rem 同行出现过 清掉返回lp0
if defined .%%a set var=!var:%%a=!&goto lp0
rem 判断%1行之前相同列是否出现过
for /l %%i in (1 1 %1) do if %%a equ !%%i%n%! set var=!var:%%a=!&goto lp0
rem 由变量a判断%1行是否1 4 7行 并判断x-v行的y-z列是否出现过
if %a% neq 1 (for /l %%j in (%x% 1 %v%) do (
for /l %%k in (%y% 1 %z%) do if %%a equ !%%j%%k! set var=!var:%%a=!&goto lp0
))
set %1!n!=%%a&set .%%a=a
rem 循环1-9列
if !n! lss 9 set/a n+=1&set var=!str:%%a=!&goto lp0
)
rem 清空变量
set str=&set n=
for /l %%i in (1 1 9) do set .%%i=
rem 判断是否的到9列 设定出错30次后 重新开始
if "!%19!"=="" set/a mn+=1&if !mn! gtr 30 (set mn=&cls&goto st)else goto lp
for /l %%i in (1 1 9) do set .%%i=&set/p=!%1%%i! <nul
echo.&set mn=
Last edited by terse on 2008-8-24 at 09:22 PM ]
Originally posted by everest79 at 2008-8-24 14:11:
Hope terse explains the algorithm, I didn't understand
@echo off&setlocal enabledelayedexpansion
:st
rem call 9 times %1-%9 that is lines 1-9
for /l %%i in (1 1 9) do call:lp %%i
pause&exit
:lp
rem get 1-9 random numbers per line
for /l %%i in (1 1 9) do set .!random!!random!!random!=%%i
for /f "tokens=1,2 delims==" %%i in ('set .') do set str=%%j !str!&set %%i=
rem clear variables in the line where %1 is located when returning to the IP tag in case of error
for /l %%i in (1 1 9) do set %1%%i=
rem set column n (starts at 1) v previous line value %1-1 y-z start column range value x start row value variable a judge whether it is line 1 4 7
set var=%str%&set/a n=1,v=%1-1,y=1,z=3,x=1,a=%1%%3
rem set x (row number) according to %1 range value
if %1 geq 4 if %1 leq 6 (set/a x=4) else set/a x=7
:lp0
rem set y-z column range value according to variable column value n
if %n% geq 4 if %n% leq 6 (set/a y=4,z=6) else set/a y=7,z=9
for %%a in (!var!) do (
rem if the same in the same line, clear and return to lp0
if defined .%%a set var=!var:%%a=!&goto lp0
rem judge whether the same column appeared before in %1 line
for /l %%i in (1 1 %1) do if %%a equ !%%i%n%! set var=!var:%%a=!&goto lp0
rem judge whether %1 line is line 1 4 7 by variable a and judge whether it appeared in y-z column of x-v lines
if %a% neq 1 (for /l %%j in (%x% 1 %v%) do (
for /l %%k in (%y% 1 %z%) do if %%a equ !%%j%%k! set var=!var:%%a=!&goto lp0
))
set %1!n!=%%a&set .%%a=a
rem loop 1-9 columns
if !n! lss 9 set/a n+=1&set var=!str:%%a=!&goto lp0
)
rem clear variables
set str=&set n=
for /l %%i in (1 1 9) do set .%%i=
rem judge whether 9 columns are obtained, set to restart after 30 times of error
if "!%19!"=="" set/a mn+=1&if !mn! gtr 30 (set mn=&cls&goto st)else goto lp
for /l %%i in (1 1 9) do set .%%i=&set/p=!%1%%i! <nul
echo.&set mn=
Last edited by terse on 2008-8-24 at 09:22 PM ]
|

简单!简单!再简单! |
|
2008-8-24 18:13 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
谢谢,呵呵
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2008-8-25 09:02 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
也是毫秒级的,之前没发到这里
@echo off &setlocal enabledelayedexpansion
:test
set "numx=123456789"
set "ca=call :next"
:first
set /a ra=%random%%%9+1,rb=%random%%%9+1
set numx=!numx:%ra%=x!
set numx=!numx:%rb%=%ra%!
set numx=!numx:x=%rb%!
if %ra% neq 9 (goto :first)
set h1=%numx%
%ca% 1 2
%ca% 2 3
set h4=%h1:~2,1%%h1:~0,2%%h1:~5,1%%h1:~3,2%%h1:~8,1%%h1:~6,2%
%ca% 4 5
%ca% 5 6
set h7=%h4:~2,1%%h4:~0,2%%h4:~5,1%%h4:~3,2%%h4:~8,1%%h4:~6,2%
%ca% 7 8
%ca% 8 9
for /l %%a in (1,1,9) do (for /l %%b in (1,1,9) do (set h%%a=!h%%a:%%b=%%b !))
for /l %%a in (1,1,9) do (echo,!h%%a!)
echo, &pause &echo,
goto :test
:next
set h%2=!h%1:~3,3!!h%1:~6!!h%1:~0,3!
goto :eof
It's also in milliseconds. It wasn't posted here before
@echo off &setlocal enabledelayedexpansion
:test
set "numx=123456789"
set "ca=call :next"
:first
set /a ra=%random%%%9+1,rb=%random%%%9+1
set numx=!numx:%ra%=x!
set numx=!numx:%rb%=%ra%!
set numx=!numx:x=%rb%!
if %ra% neq 9 (goto :first)
set h1=%numx%
%ca% 1 2
%ca% 2 3
set h4=%h1:~2,1%%h1:~0,2%%h1:~5,1%%h1:~3,2%%h1:~8,1%%h1:~6,2%
%ca% 4 5
%ca% 5 6
set h7=%h4:~2,1%%h4:~0,2%%h4:~5,1%%h4:~3,2%%h4:~8,1%%h4:~6,2%
%ca% 7 8
%ca% 8 9
for /l %%a in (1,1,9) do (for /l %%b in (1,1,9) do (set h%%a=!h%%a:%%b=%%b !))
for /l %%a in (1,1,9) do (echo,!h%%a!)
echo, &pause &echo,
goto :test
:next
set h%2=!h%1:~3,3!!h%1:~6!!h%1:~0,3!
goto :eof
|

综合型编程论坛
我的作品索引 |
|
2009-12-26 15:11 |
|
|