本帖最后由 老刘1号 于 2022-7-1 19:13 编辑
一万年后学了数理逻辑+位运算+数字电路的我又回来了
可读性≈0- @echo off
-
- set /a a=%random%,b=%random%
-
- rem swap a & b to makes a >= b if nessary
- set /a "c=((a-b)>>31)+1"
- set /a "d=c*a+(1-c)*b"
- set /a "e=(1-c)*a+c*b"
- rem echo %a% %b% %c% %d% %e%
- set /a "a=d,b=e"
-
- rem get greatest common divisor of a & b into a
- :g0
- set /a "c=a%%b,a=b,b=c,gend=!c"
- rem echo %a% %b%
- goto g%gend%
-
- :g1
- echo %d% %e% -^> %a%
- pause
复制代码 论坛这个万年屏蔽词…幸好我又看了一眼 |