반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
//3 16
//result
//3
//5
//7
//11
//13
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String str = br.readLine();
StringTokenizer st = new StringTokenizer(str);
int start = Integer.parseInt(st.nextToken());
int end = Integer.parseInt(st.nextToken());
boolean[] bool = new boolean[end + 1];
for(int i = 2; i < bool.length; i++) {
bool[i] = true;
}
if(bool[i]) {
for(int j = i * i; j < bool.length; j += i) {
bool[j] = false;
}
}
}
for(int i = start; i <= end; i++) {
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
반응형
'IT > 알고리즘' 카테고리의 다른 글
백준 9단계(9020) (0) | 2019.12.22 |
---|---|
백준 9단계(4948) (0) | 2019.12.22 |
백준 9단계(2581) (0) | 2019.12.22 |
백준 9단계(1978) (0) | 2019.12.21 |
백준 8단계(1011) (0) | 2019.12.21 |