From 317f6ce9ed31ba9e7d8366767ef3d80c4d38f4a8 Mon Sep 17 00:00:00 2001 From: sa11k Date: Thu, 7 Jul 2022 22:17:46 +0900 Subject: [PATCH] Feat:Add solution of #118 --- src/BaekJoon/sa11k/1018/Main.java | 103 ++++++++++++++++++++++++++++++ src/BaekJoon/sa11k/1085/Main.java | 30 +++++++++ src/BaekJoon/sa11k/1181/Main.java | 35 ++++++++++ src/BaekJoon/sa11k/1259/Main.java | 27 ++++++++ src/BaekJoon/sa11k/1436/Main.java | 24 +++++++ 5 files changed, 219 insertions(+) create mode 100644 src/BaekJoon/sa11k/1018/Main.java create mode 100644 src/BaekJoon/sa11k/1085/Main.java create mode 100644 src/BaekJoon/sa11k/1181/Main.java create mode 100644 src/BaekJoon/sa11k/1259/Main.java create mode 100644 src/BaekJoon/sa11k/1436/Main.java diff --git a/src/BaekJoon/sa11k/1018/Main.java b/src/BaekJoon/sa11k/1018/Main.java new file mode 100644 index 0000000..2d37b5a --- /dev/null +++ b/src/BaekJoon/sa11k/1018/Main.java @@ -0,0 +1,103 @@ +import java.io.*; +import java.util.*; + +class Main{ + static boolean[][] chess; + static int result = Integer.MAX_VALUE; + static int N, M; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine(), " "); + + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + chess = new boolean[N][M]; // W : true, B : false + + for(int i = 0; ir && first == chess[i][c]){ + count++; + first = !chess[i][c]; + condition = !chess[i][c]; + }else if(i>r && first != chess[i][c]) { + first = chess[i][c]; + condition = chess[i][c]; + } + for(int j = c+1; jr && first == chess[i][c]){ + count++; + first = !chess[i][c]; + condition = !chess[i][c]; + }else if(i>r && first != chess[i][c]) { + first = chess[i][c]; + condition = chess[i][c]; + } + for(int j = c+1; jleft) result = left; + if(result>right) result = right; + if(result>up) result = up; + if(result>down) result = down; + } +} \ No newline at end of file diff --git a/src/BaekJoon/sa11k/1181/Main.java b/src/BaekJoon/sa11k/1181/Main.java new file mode 100644 index 0000000..188a855 --- /dev/null +++ b/src/BaekJoon/sa11k/1181/Main.java @@ -0,0 +1,35 @@ +import java.io.*; +import java.util.*; + +class Main{ + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + String[] word = new String[N]; + + for(int i = 0; i() { + @Override + public int compare(String s1, String s2) { + if(s1.length() == s2.length()){ + return s1.compareTo(s2); + }else{ + return s1.length()-s2.length(); + } + } + }); + + System.out.println(word[0]); + + for(int i = 1; i=0; i--){ + reverseNum += num.charAt(i); + } + + if(num.equals(reverseNum)){ + System.out.println("yes"); + }else{ + System.out.println("no"); + } + } + + br.close(); + } +} \ No newline at end of file diff --git a/src/BaekJoon/sa11k/1436/Main.java b/src/BaekJoon/sa11k/1436/Main.java new file mode 100644 index 0000000..4c3e592 --- /dev/null +++ b/src/BaekJoon/sa11k/1436/Main.java @@ -0,0 +1,24 @@ +import java.io.*; +import java.util.*; + +class Main{ + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int check = Integer.parseInt(br.readLine()); + int count = 0; + int i = 666; + + while(count != check){ + String num = i+""; + if(num.contains("666")){ + count++; + } + i++; + } + + System.out.println(i-1); + + + br.close(); + } +} \ No newline at end of file