看起来貌似是个很没营养的问题,网上一搜一大堆,粗制滥造的答案看就能看吐。
求质数,比如:
求 N 是否为质数?那就从 i=2 一直遍历到 i=N-1 之后求余呗,只要余数有为 0 的,那 N 就不是质数————这是不少网上教程给出的答案,可能不少计算机专业老师也是这么教课的。
衍生题目还有:
- 求 从 1 到 N 之间所有质数
- 从 1 开始,求 N 个质数
- 求 从 M 到 N 之间所有质数
- 从 M 开始,求 N 个质数
Oct 31 2016
Oct 09 2016
这是一个微信配置检测工具。在有 appID 和 appsecret 的条件下,可以:
可用于检测部分微信配置是否正确,并测试模板消息发送。
在Linux命令行下运行完美,需要php环境支持。
GitHub地址:https://github.com/catscarlet/Wechat-Configure-Tester
Sep 07 2016
Segmentfault原文地址:关于php中的switch语句 报错
说真的,他这段代码,写的真的,不咋地……
当然我不是来写文章批判他的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
switch($rank) { case 1: $speed = 50; break; case 2: $speed = 48; break; /*…… 中略 ……*/ case 9: $speed = 37; break; case 10: $speed = 36; break; case 21 > '$rand' >10: $speed = 35; break; case 31 > '$rand' > 20: $speed = 34; break; /*…… 中略 ……*/ case 401 > '$rand' > 300: $speed = 27; break; case 501 > '$rand' > 400: $speed = 26; break; } //在运行的时候报错>符号有误 这是什么情况啊 |
May 17 2016
May 06 2016
If you upgrade your XML Sitemap & Google News feeds to version 4.7, your wordpress may get a error message:
Parse error: syntax error, unexpected '[' in ...wp-content\plugins\xml-sitemap-feed\includes\class-xmlsitemapfeed.php on line 703...
.
If you don’t want to wait a newer version to fix this error, and don’t want to downgrade this plugin, you can fix this error by yourself.
Jan 04 2016
近期评论