Add tags

Add tags to the following comment

別のアルゴリズムで解いてみました。

数が大きくなれば有利かな?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
public class Sample206 {
    public static void main(String[] args) {
        OUTER: for (int i = 1, n = 0; n < 100; i++) {
            for (int p = 7; p <= i; p += 2) {
                if (p % 3 == 0) continue;
                if (p % 5 == 0) continue;
                if (i % p == 0) {
                    continue OUTER;
                }
            }
            System.out.println(i);
            n++;
        }
    }
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...