목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/15685 15685번: 드래곤 커브 첫째 줄에 드래곤 커브의 개수 N(1 ≤ N ≤ 20)이 주어진다. 둘째 줄부터 N개의 줄에는 드래곤 커브의 정보가 주어진다. 드래곤 커브의 정보는 네 정수 x, y, d, g로 이루어져 있다. x와 y는 드래곤 커 www.acmicpc.net import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Main_BOJ_15685 { ..
https://www.acmicpc.net/problem/15683 15683번: 감시 스타트링크의 사무실은 1×1크기의 정사각형으로 나누어져 있는 N×M 크기의 직사각형으로 나타낼 수 있다. 사무실에는 총 K개의 CCTV가 설치되어져 있는데, CCTV는 5가지 종류가 있다. 각 CCTV가 감 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.List; import java.util.StringTokenizer; public class M..
https://programmers.co.kr/learn/courses/30/lessons/42883# 코딩테스트 연습 - 큰 수 만들기 programmers.co.kr import java.util.*; class Solution { public String solution(String number, int k) { StringBuilder sb=new StringBuilder(""); int answer_size=number.length()-k; int idx=0; Stack stack=new Stack(); while (idx숫자가 같다면 나오는 순서가 빠른 순서부터 해서 골라서 더하고, 남은 값들은 다시 pq 안에 넣어서 조건에 맞는 수(범위가 맞는가, 지금 뽑았던 수보다 이전에 나온 수는 아닌가..
https://programmers.co.kr/learn/courses/30/lessons/42885 코딩테스트 연습 - 구명보트 무인도에 갇힌 사람들을 구명보트를 이용하여 구출하려고 합니다. 구명보트는 작아서 한 번에 최대 2명씩 밖에 탈 수 없고, 무게 제한도 있습니다. 예를 들어, 사람들의 몸무게가 [70kg, 50kg, 80kg, 5 programmers.co.kr import java.util.Arrays; class Solution { public int solution(int[] people, int limit) { int boat=0; Arrays.sort(people);//오름차순으로 정렬 int q=limit; int start=0;//최소값부터 시작하는 포인터 int end=peopl..