黑糖姜茶,美女pk精子小游戏,哥哥用力
利用正则判别素数,来源于网络,神人!
set regex = new regexp
regex.pattern = "^1?$¦^(11+?)\1+$"
for i = 1 to 100
if not regex.test(string(i,"1")) then
wscript.echo i
end if
next
看到标题你一定会不屑一顾,枚举质数谁不会?
for i = 1 to 100
for j = 2 to i
if i mod j = 0 then exit for
next
if j = i then wscript.echo i
next
几行代码就能搞定,如此简单。那就看看下面这个程序吧!
set regex = new regexp
regex.pattern = "^1?$|^(11+?)\1+$"
for i = 1 to 100
if not regex.test(string(i,"1")) then
wscript.echo i
end if
next
用正则表达式判断质数,神一样的人物。
来源:
http://demon.tw/programming/vbs-prime-number.html
http://www.enun.net/?p=533
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论