File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .io .*;
2
+ import java .util .*;
3
+ import java .util .stream .*;
4
+
5
+ public class App {
6
+ public static void main (String [] args ) throws IOException {
7
+ /*
8
+ * 1920번
9
+ * 자료 구조
10
+ * 정렬
11
+ * 이분 탐색
12
+ */
13
+ // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
14
+ BufferedReader br = new BufferedReader (new FileReader ("1920/input.txt" ));
15
+ BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System .out ));
16
+ int [] ll = { 0 };
17
+ int [][] arys = new int [2 ][];
18
+ br .lines ()
19
+ .filter (s -> ll [0 ]++ % 2 != 0 )
20
+ .limit (2 )
21
+ .map (l -> Arrays .stream (l .split (" " )).mapToInt (Integer ::parseInt ).toArray ())
22
+ .forEach (arr -> {
23
+ if (arys [0 ] == null ) {
24
+ arys [0 ] = arr ;
25
+ } else {
26
+ arys [1 ] = arr ;
27
+ Arrays .stream (arys [1 ])
28
+ .mapToLong (i -> IntStream .of (arys [0 ]).anyMatch (i2 -> i2 == i ) ? 1 : 0 )
29
+ .forEach (r -> {
30
+ try {
31
+ bw .write (r + "\n " );
32
+ } catch (IOException e ) {
33
+ }
34
+ });
35
+ }
36
+ });
37
+ bw .flush ();
38
+ bw .close ();
39
+ br .close ();
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ 5
2
+ 4 1 5 2 3
3
+ 5
4
+ 1 3 7 9 5
You can’t perform that action at this time.
0 commit comments