HW6.6

public class Solution
{
public static void main(String[] args)
{
int[] prime = new int[50];
prime[0] = 2;
int i = 0;
int j = 3;
boolean judgment = false;
while(true)
{
i = 0;
while(i < 50 && prime[i] != 0)
{
if(j % prime[i] == 0)
{
judgment = false;
break;
}
i++;
}
for(int k = 0; k < 50; k++)
{
if(judgment == true && prime[k] == 0)
{
prime[k] = j;
break;
}
}
judgment = true;
j++;
if(prime[prime.length - 1] != 0)
break;
}
int count = 0;
for(int k = 0; k < 50; k++)
{
System.out.print(prime[k] + " ");
count++;
if(count == 10)
{
System.out.println();
count = 0;
}
}
}
}
HW6.6的更多相关文章
- HW6.30
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.29
public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...
- HW6.28
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.27
import java.util.Scanner; import java.util.Arrays; public class Solution { public static void main(S ...
- HW6.26
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.25
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- HW6.24
public class Solution { public static void main(String[] args) { int count = 0; int color; int numbe ...
- HW6.23
public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; f ...
- HW6.22
import java.util.Arrays; public class Solution { public static void main(String[] args) { int[][] ch ...
- HW6.21
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
随机推荐
- 互斥锁Mutex与信号量Semaphore的区别
转自互斥锁Mutex与信号量Semaphore的区别 多线程编程中,常常会遇到这两个概念:Mutex和Semaphore,两者之间区别如下: 有人做过如下类比: Mutex是一把钥匙,一个人拿了就可进 ...
- Docker 监控实战
如今,越来越多的公司开始使用 Docker 了,现在来给大家看几组数据: 2 / 3 的公司在尝试了 Docker 后最终使用了它 也就是说 Docker 的转化率达到了 67%,而转化市场也控制在 ...
- JSON用法简介
[JSON简介] jsoncpp 主要包含三种类型的 class:Value.Reader.Writer.jsoncpp 中所有对象.类名都在 namespace Json 中,包含 json.h 即 ...
- 【BZOJ 2453|bzoj 2120】 2453: 维护队列 (分块+二分)
2453: 维护队列 Description 你小时候玩过弹珠吗? 小朋友A有一些弹珠,A喜欢把它们排成队列,从左到右编号为1到N.为了整个队列鲜艳美观,小朋友想知道某一段连续弹珠中,不同颜色的弹珠有 ...
- 99. Recover Binary Search Tree
题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without chan ...
- Move to Another Changelist
Move to Another Changelist 将选中的文件转移到其他的 Change list 中. Change list 是一个重要的概念,这里需要进行重点说明.很多时候,我们开发一个项目 ...
- jqueryrotate 使用 帮助 笔记 学习
1.想变角度 $("imgID").rotate(45); 2.想变角度时,有运动过程 $("imgID").rotate({animateTo:45} ...
- 登陆shell与交互式非登陆shell的区别
登录shell 所谓登录shell,指的是当用户登录系统时所取的那个shell,登录shell属于交互式shell. 登录shell将查找4个不同的启动文件来处理其中的命令. bash shell处理 ...
- 【POJ】2104 K-th Number
区间第K大数.主席树可解. /* 2104 */ #include <iostream> #include <sstream> #include <string> ...
- vsphere client cd/dvd 驱动器1 正在连接
esxi 5.1选择了客户端设备,打开控制台后,CD/DVD一直显示“CD/DVD驱动器1 正在连接” 解决方法:vSphere Client客户端问题,关闭和重新打开vSphere Client客户 ...