回答編集履歴
2
型間違い
answer
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
int n = 100000000;
|
8
8
|
|
9
9
|
long goukei = 0;
|
10
|
-
boolean[] notPrime = new
|
10
|
+
boolean[] notPrime = new boolean[n + 1];
|
11
11
|
|
12
12
|
notPrime[0] = notPrime[1] = true;
|
13
13
|
|
1
変なピリオド入ってた
answer
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
int root = (int)Math.sqrt(n);
|
15
15
|
for (int i = 2; i <= n; i ++) {
|
16
16
|
if (notPrime[i]) continue;
|
17
|
-
goukei += i;
|
17
|
+
goukei += i;
|
18
18
|
if(i > root) continue;
|
19
19
|
for (int p = i * i; p <= n; p += i) {
|
20
20
|
notPrime[p] = true;
|