-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3190(뱀).java
More file actions
61 lines (46 loc) · 1.74 KB
/
3190(뱀).java
File metadata and controls
61 lines (46 loc) · 1.74 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Naong {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int K = Integer.parseInt(br.readLine());
boolean arr[][] = new boolean[N][N];
for(int i = 0; i < K; i++){ //사과위치 true
StringTokenizer st = new StringTokenizer(br.readLine()," ");
int indexI = Integer.parseInt(st.nextToken());
int indexJ = Integer.parseInt(st.nextToken());
arr[indexI-1][indexJ-1] = true;
}
String check[] = new String[10001];
int L = Integer.parseInt(br.readLine());
for(int i = 0; i < L; i++){
StringTokenizer st = new StringTokenizer(br.readLine()," ");
int num = Integer.parseInt(st.nextToken());
String temp = st.nextToken();
check[num] = temp;
}
int count = 0;
int snake = 1; //뱀 몸길이
int currentI = 0;
int currentJ = 0;
int dx[] = {0, 1, 0, -1}; //우 하 상 좌
int dy[] = {1, 0, -1, 0};
int currentDirection = 0; //처음엔 0,0 에서 오른쪽간다함
Deque<Pair> queue = new ArrayDeque<>();
while(true){
if(currentI > N-1 || currentJ > N-1){
break;
}
if(check[count] != null){
if(check[count].equals("D")){ //D면 오른쪽턴
currentDirection++;
}else{ //L인경우
currentDirection--;
}
}
}
}
}