分解质因数(asp 分布递归法) — IT技术

2013 年 8 月 11 日3910

***start input.asp***<% thenum= request("num") %><style type="text/css"><!--.trees {border-color: black black black #666666; padding-left: 12px; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 3px; margin-top: 2px; margin-bottom: 2px}--></style><div class = "trees"><%=thenum%><span><iframe name = "agent<%=thenum%>" src="prime_number.asp?num=<%=thenum%>"></iframe></span></div>***end input.asp******start prime_number.asp***<%IsPrimeNumber = falsethenum = request("num")if thenum = 2 or thenum = 1 then IsPrimeNumber = falseelsefor i = 2 to thenum -1if thenum / i = int(thenum / i) then IsPrimeNumber = true: m = i : exit fornextend ifif IsPrimeNumber = false then %><script>var htmltext = '<div class = "trees"><%=thenum%>*</div>';parent.follow<%=thenum%>.innerHTML = htmltext;</script><%else%><%k = thenum / m%><script>var htmltext = '<div class = "trees"><%=m%>*</div><div class = "trees"><%=k%><span><iframe name = "agent<%=k%>" src="prime_number.asp?num=<%=k%>"></iframe></span></div>';parent.follow<%=thenum%>.innerHTML = htmltext;</script><%end if%>***end prime_number.asp***算法应用:分布多线程树读取

字体[ 进入论坛] [ 推荐给朋友]

0 0