Skip to content

Commit 981699a

Browse files
authored
Merge pull request #508 from AlgorithmWithGod/khj20006
[20250720] BOJ / G4 / 젓가락으로 메추리알 집기 / 권혁준
2 parents 0cbecc8 + 5f8e39e commit 981699a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```java
2+
import java.util.*;
3+
import java.io.*;
4+
5+
public class Main {
6+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7+
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
8+
9+
public static void main(String[] args) throws Exception {
10+
StringTokenizer st = new StringTokenizer(br.readLine());
11+
int N = Integer.parseInt(st.nextToken());
12+
int M = Integer.parseInt(st.nextToken());
13+
14+
for(int i=1;i<=N;i++) for(int j=(i%2==1 ? 2 : 1);j<=M;j+=2) {
15+
bw.write("? " + i + " " + j + "\n");
16+
bw.flush();
17+
if(br.readLine().equals("1")) return;
18+
}
19+
20+
}
21+
22+
}
23+
```

0 commit comments

Comments
 (0)