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的更多相关文章

  1. HW6.30

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  2. HW6.29

    public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int ...

  3. HW6.28

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  4. HW6.27

    import java.util.Scanner; import java.util.Arrays; public class Solution { public static void main(S ...

  5. HW6.26

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  6. HW6.25

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  7. HW6.24

    public class Solution { public static void main(String[] args) { int count = 0; int color; int numbe ...

  8. HW6.23

    public class Solution { public static void main(String[] args) { boolean[] box = new boolean[101]; f ...

  9. HW6.22

    import java.util.Arrays; public class Solution { public static void main(String[] args) { int[][] ch ...

  10. HW6.21

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

随机推荐

  1. C++ 嵌套类使用(二)

    C++嵌套类 1.   嵌套类的名字只在外围类可见. 2.   类的私有成员只有类的成员和友元可以访问,因此外围类不可以访问嵌套类的私有成员.嵌套类可以访问外围类的成员(通过对象.指针或者引用). 3 ...

  2. DJANGO中filter_horizontal和raw_id_fields的作用

    在作多项选择的操作方便性,及单项选择太多时,会有好一点的体验... class UserAuthorAdmin(admin.ModelAdmin): # raw_id_fields = ('group ...

  3. linux 修改命令行编码 乱码解决方案

    修改/etc/default/locale命令:sudo vim /etc/default/locale1将下面这两行 LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh 修改为: ...

  4. http://www.ibm.com/developerworks/cn/java/j-lo-hotswapcls/

    http://www.ibm.com/developerworks/cn/java/j-lo-hotswapcls/

  5. SGU128 Snake

    SGU128,题意是给定N个点,问说能不能形成一个闭环G,要求G经过每个点,且在每个点处都有90度的转角,且不能出现自交. 没想出来,通过这提供的思路,由于每个点处都需要90度的转弯,因此每个点处必然 ...

  6. POJ2632——Crashing Robots

    Crashing Robots DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful pl ...

  7. 哈希值识别工具hash-identifier

    Hash Identifier可以用来识别各种类型的哈希值.在kali上使用方法很简单 (1)搜索hash-identifier (2)在HASH后面输入要识别的hash内容 (3)识别成功 wind ...

  8. jekyll themes

    jekyll主题下载: https://mademistakes.com/work/jekyll-themes/ https://github.com/jekyll/jekyll/wiki/Theme ...

  9. hdu 3549 Flow Problem(增广路算法)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=3549 模板题,白书上的代码... #include <iostream> #include & ...

  10. freemarker截取字符串

    [#if   a.title?length   lt   23   ]   ${a.title} [#else]${a.title[0..22]}...[/#if]