 
- 帖子
- 640
- 积分
- 2841
- 技术
- 102
- 捐助
- 0
- 注册时间
- 2008-1-17
|
真正的秒杀:@echo off&if not %1.==. call%*&exit/b:: Code By plp626
title 输出任意多的互质(素)的勾股数&echo 稍等...
set MAX=30 &rem ::1000的开平方为31.6,这里设定MAX为30,就已经遍历1000以内的勾股质数
set "_isprime=set #r=+&for /l %%a in (1 1 6)do if ^!#r^! neq 0 (set/a #r=#1%%#2,#1=#2,#2=#r) else set ans=!#1!"
for /f "delims=" %%a in ('%~s0 :rtnum^|sort')do echo.%%a
pause&exit/b
:rtnum
setlocal enabledelayedexpansion&set "s= "
for /l %%n in (1 1 %MAX%)do (set/a tp=%%n+1
for /l %%m in (!tp! 2 %MAX%)do (set #1=%%m&set #2=%%n&%_isprime%
if !ans! equ 1 (set/a mm=%%m*%%m,nn=%%n*%%n,a=mm-nn,b=2*%%m*%%n,c=mm+nn
set a=%s%!a!&set b=%s%!b!&set c=%s%!c!
if !a! lss !b! (echo !a:~-7! !b:~-7! !c:~-7!) else echo !b:~-7! !a:~-7! !c:~-7!
)))
exit/b [ 本帖最后由 plp626 于 2009-10-15 14:46 编辑 ] |
-
3
评分人数
-
|