Skip to content

Commit 1ae266e

Browse files
committed
BOJ_1783 : 병든 나이트
1 parent cd340e9 commit 1ae266e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

week1/BOJ_1783(병든 나이트).java

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.io.*;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) throws IOException {
6+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7+
String[] input = br.readLine().split(" ");
8+
int N = Integer.parseInt(input[0]);
9+
int M = Integer.parseInt(input[1]);
10+
if(N == 1) {
11+
System.out.println("1");
12+
}else if(N == 2) {
13+
System.out.println(Math.min(4, (M+1)/2));
14+
}else {
15+
if(M <= 6) {
16+
System.out.println(Math.min(4, M));
17+
}else {
18+
System.out.println(M-2);
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)