목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/2638 2638번: 치즈 첫째 줄에는 모눈종이의 크기를 나타내는 두 개의 정수 N, M (5 ≤ N, M ≤ 100)이 주어진다. 그 다음 N개의 줄에는 모눈종이 위의 격자에 치즈가 있는 부분은 1로 표시되고, 치즈가 없는 부분은 0으로 www.acmicpc.net import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util...
https://programmers.co.kr/learn/courses/30/lessons/42628 코딩테스트 연습 - 이중우선순위큐 programmers.co.kr import java.util.*; class Solution { public int[] solution(String[] operations) { int[] answer; LinkedList q=new LinkedList(); for (int i=0; i최대면 뒤에 있는 것을 뽑는 식으로 진행했다. 그런데 정석 풀이는 아닌 것 같다. 다른 분의 코드를 보니, 큐를 최소 큐, 최대 큐 2개를 만들어서 최소 큐 아이템을 뽑았을 때 최대 큐에서도 그 아이템을 remove 해준다. 최대 큐 아이템을 뽑았을 때도 마찬가지로 진행해준다. 그렇게 하면..
https://programmers.co.kr/learn/courses/30/lessons/12979 코딩테스트 연습 - 기지국 설치 N개의 아파트가 일렬로 쭉 늘어서 있습니다. 이 중에서 일부 아파트 옥상에는 4g 기지국이 설치되어 있습니다. 기술이 발전해 5g 수요가 높아져 4g 기지국을 5g 기지국으로 바꾸려 합니다. 그런데 5 programmers.co.kr import java.util.*; class Solution { public int solution(int n, int[] stations, int w) { int answer = 0; int dist=(2*w)+1; int s=1; int start=0, end=0; for (int i=0; i0){ if (len%dist==0){ ans..
https://www.acmicpc.net/problem/9935 9935번: 문자열 폭발 첫째 줄에 문자열이 주어진다. 문자열의 길이는 1보다 크거나 같고, 1,000,000보다 작거나 같다. 둘째 줄에 폭발 문자열이 주어진다. 길이는 1보다 크거나 같고, 36보다 작거나 같다. 두 문자열은 모 www.acmicpc.net import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main_BOJ_9935 { public static void main(String[] args) throws IOException { BufferedR..