본문 바로가기

Coding Test

(221)
[백준/자바] 2869 - 달팽이는 올라가고 싶다 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken()); int b = Integer.pa..
[백준/자바] 10989 - 수 정렬하기 3 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); int[] arr = new int[n]; for(int i=0; i
[백준/자바] 10798 - 세로읽기 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String[] arr = new String[5]; int max = 0; for(int i=0; i
[백준/자바] 2164 - 카드2 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int result; if(n == 1) result = 1; else if(n
[프로그래머스/자바] 튜플 ❌ 실패 코드(런타임 에러) ❌ String을 계속해서 수정하는 코드라 그런지 런타임 에러가 났다. import java.util.Arrays; import java.util.Comparator; class Solution { public int[] solution(String s) { int[] result; if(!s.contains(",")){ result = new int[1]; result[0] = Integer.parseInt(s.substring(2, s.length() - 2)); } else { String[] bits = s.substring(2, s.length() - 2).split("},\\{"); Arrays.sort(bits, Comparator.comparingInt(Stri..
[백준/자바] 2566 - 최댓값 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[][] matrix = new int[9][9]; int num = -1; int row = 0; int column = 0; for(int i=0; i
[백준/자바] 9012 - 괄호 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int t = Integer.parseInt(br.readLine()); for(int i=0; i
[백준/자바] 2738 - 행렬 덧셈 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] nm = br.readLine().split(" "); int n = Integer.parseInt(nm[0]); int m = Integer.parseInt(nm[1]); int[][] matrix = new int[n][m]; for(String s ..