java 347

[백준] 1522번. 문자열 교환(JAVA)

문제https://www.acmicpc.net/problem/1522풀이(36분)import java.util.*;import java.io.*;public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); int aCount = 0; for(int i = 0; i 문제 풀이 전략 실버 1 문제라고 만만하게 봤다가 시간을 매우 오래 쓴 문제이다.사실 문제를 읽는 순간부터 별다른 아이디어가 떠..

[백준] 1342번. 행운의 문자열(JAVA)

문제https://www.acmicpc.net/problem/1342풀이(15분)import java.util.*;import java.io.*;public class Main { static Set alphabet = new HashSet(); // 사용될 알파벳 집합 static int[] alphabetCount = new int[26]; // 알파벳의 개수를 체크할 배열 static int count, stringLength; // 정답 개수와 문장의 길이 public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReade..

[백준] 2437번. 저울(JAVA)

문제https://www.acmicpc.net/problem/2437풀이(12분)import java.util.*;import java.io.*;public class Main { // 오름차순으로 정렬해서 빼내자. // 최댓값을 구성할 수 있다는거는 거기까지는 전부 만들 수 있다는 소리이다. // 예를 들어, 이전 최댓값이 4였고, 다음 값이 4여서 최대 8이 된다고 치자. // 그럼 1,2,3,4가 전부 있었다는 소리이기 때문에 5,6,7도 자동으로 구성되고 8까지 가능해진다. public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new Inp..

[프로그래머스] 요격 시스템(JAVA)

문제https://school.programmers.co.kr/learn/courses/30/lessons/181188풀이(16분)import java.util.*;import java.io.*;class Solution { public int solution(int[][] targets) { // e 오름차순 정렬 Arrays.sort(targets, (o1, o2) -> o1[1] - o2[1]); int ans = 0; int x = 0; for (int[] target : targets) { if (x 문제 풀이 전략 괜히 어렵게 생각하느라 시간을 좀 쓴 문제이다.풀이 방법은 간단하다. 1. 끝점..