[SWEA] 1989번 초심자의 회문 검사 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sbAnswer = new StringBuilder(); int n = kb.nextInt(); for(int i=0; i 공부기록/SWEA 2023.10.19
[SWEA] 1284번 수도 요금 경쟁 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int T = kb.nextInt(); for(int i=0; iR) { BCharge = Q+ S*(W-R); }else { BCharge = Q; } sb.append("#").append(i+1).append(" "); if(ACharge>BCharge) { sb.append(BCharge); }else { sb.append(ACharge); } sb.append('\n'); } System.out.pr.. 공부기록/SWEA 2023.10.19
[SWEA] 2019번 더블더블 public class Solution { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); StringBuilder sb = new StringBuilder(); int num=1; sb.append(num).append(" "); for(int i=0; i 공부기록/SWEA 2023.10.19
[SWEA] 2071번 평균값 구하기 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); for(int i=0; i 공부기록/SWEA 2023.10.19
[SWEA] 1545번 거꾸로 출력해 보아요 import java.util.Arrays; import java.util.Collections; import java.util.Scanner; class Solution { public static void main(String args[]) throws Exception { Scanner kb = new Scanner(System.in); int num = kb.nextInt(); Integer[] arr = new Integer[num+1]; for(int i=0; i< arr.length; i++) { arr[i] = i; } Arrays.sort(arr, Collections.reverseOrder()); for(int x: arr) { System.out.print(x+ " "); } } } 공부기록/SWEA 2023.10.19
[SWEA] 1976번 시각 덧셈 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); for(int i=0; i=60) { resultM = (m1+m2)%60; resultH++; } if(resultH>12) { resultH = resultH%12; if(resultH == 0) { resultH = 12; } } System.out.println("#"+(i+1)+" "+resultH+" "+ resultM); } } } 공부기록/SWEA 2023.10.19
[프로그래머스] K번째 수 import java.util.*; class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; for(int i=0; i 공부기록/프로그래머스 2023.10.17
[백준] 2941번 크로아티아 알파벳 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String[] find = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="}; String str = kb.next(); for (int i = 0; i < find.length; i++) { if (str.contains(find[i])) str = str.replace(find[i], "*"); } System.out.println(str.length()); } } 공부기록/백준 2023.10.15
[프로그래머스] 카드 뭉치 import java.util.*; class Solution { public String solution(String[] cards1, String[] cards2, String[] goal) { Queue queue1 = new LinkedList(); Queue queue2 = new LinkedList(); for(String x: cards1){ queue1.add(x); } for(String x: cards2){ queue2.add(x); } for(int i=0; i 공부기록/프로그래머스 2023.10.15
[백준] 9012번 괄호 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { static String pro(String s) { Stack stack = new Stack(); for (char c : s.toCharArray()) { if (c == '(') { stack.push(c); } else if (c == ')') { if (!stack.isEmpty() && stack.pop() == '(') { continue; } else { return "NO"; } } } if (!stack.isEmpty()) { return "N.. 공부기록/백준 2023.10.15