1。自然数是0,1,2……2。素数是2,3,5……(不包括1的只能背1和它本身整除的自然数)public class Test { /* * 最普通的算法: * 打印num以内的素数并返回素数个数 * n、m分别为外、内层循环,i是第几个素数,s是素数个数 */ public int prime(int num){ int n,m,i=0,s=0; label1: for(n=2;n<=num;n++) { for(m=2;m<=n/2;m++) { if(n%m==0) continue label1; } s++; ...
- 15:28
- 浏览 (544)
- 评论 (0)
- 分类: Arithmetic
插入排序:package org.rut.util.algorithm.support;import org.rut.util.algorithm.SortUtil;/** * @author treeroot * @since 2006-2-2 * @version 1.0 */public class InsertSort implements SortUtil.Sort{ /* (non-Javadoc) * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[]) */ public void sort( ...
- 15:27
- 浏览 (388)
- 评论 (0)
- 分类: Arithmetic
- 浏览: 68467 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
最新评论
-
Java中文问题及最优解决方 ...
<script type="text/javascript"> alert ...
-- by youngsailer -
(hibernate)inverse,casca ...
很好啊,谢谢!
-- by elesen -
tomcat and resin服务器如 ...
resin 设置会有问题吧
-- by beauty9235 -
jsp中的四种范围(page|r ...
请教一下 如何在自定义标签里pageContext.setAttribute,然 ...
-- by blu3leaf -
提高JSP应用程序运行速度 ...
恩,对jsp的性能有帮助。
-- by leonardleonard






评论排行榜