We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd340e9 commit 1ae266eCopy full SHA for 1ae266e
week1/BOJ_1783(병든 나이트).java
@@ -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
18
+ System.out.println(M-2);
19
+ }
20
21
22
+}
0 commit comments