baekjoon

문제 링크 https://www.acmicpc.net/problem/1931 1931번: 회의실 배정 (1,4), (5,7), (8,11), (12,14) 를 이용할 수 있다. www.acmicpc.net 문제 풀이 fun main() = with(System.`in`.bufferedReader()) { val n = readLine().toInt() val times = Array(n) { Array(2) { 0 } } repeat(n) { val line = readLine().split(" ") times[it][0] = line[0].toInt() times[it][1] = line[1].toInt() } times.sortWith(compareBy { it[1] }.thenBy { it[0] }..
· Algorithm
문제 링크 https://www.acmicpc.net/problem/2217 2217번: 로프 N(1 ≤ N ≤ 100,000)개의 로프가 있다. 이 로프를 이용하여 이런 저런 물체를 들어올릴 수 있다. 각각의 로프는 그 굵기나 길이가 다르기 때문에 들 수 있는 물체의 중량이 서로 다를 수도 있다. 하 www.acmicpc.net 문제 풀이 import kotlin.math.max fun main() = with(System.`in`.bufferedReader()) { val n = readLine().toInt() val weights = Array(n) { 0 } for (i in 0..< n) { weights[i] = readLine().toInt() } weights.sort() var maxW..
· Algorithm
문제 링크 https://www.acmicpc.net/problem/11047 11047번: 동전 0 첫째 줄에 N과 K가 주어진다. (1 ≤ N ≤ 10, 1 ≤ K ≤ 100,000,000) 둘째 줄부터 N개의 줄에 동전의 가치 Ai가 오름차순으로 주어진다. (1 ≤ Ai ≤ 1,000,000, A1 = 1, i ≥ 2인 경우에 Ai는 Ai-1의 배수) www.acmicpc.net 문제 풀이 fun main() = with(System.`in`.bufferedReader()) { var (n, k) = readLine().split(" ").map { it.toInt() } val coins = mutableListOf() var result = 0 repeat(n) { coins.add(readLi..
YOONJELLY
'baekjoon' 태그의 글 목록