From 80da6252c4d0ca3c8e484343821260c9a7cf9809 Mon Sep 17 00:00:00 2001 From: yubin Date: Mon, 8 Jan 2024 00:00:24 +0900 Subject: [PATCH] =?UTF-8?q?solve(BOJ):=20G5=5F11509=5F=ED=92=8D=EC=84=A0?= =?UTF-8?q?=5F=EB=A7=9E=EC=B6=94=EA=B8=B0=5Fkt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0_\353\247\236\354\266\224\352\270\260.kt" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "src/boj/G5_11509_\355\222\215\354\204\240_\353\247\236\354\266\224\352\270\260.kt" diff --git "a/src/boj/G5_11509_\355\222\215\354\204\240_\353\247\236\354\266\224\352\270\260.kt" "b/src/boj/G5_11509_\355\222\215\354\204\240_\353\247\236\354\266\224\352\270\260.kt" new file mode 100644 index 0000000..09af7b2 --- /dev/null +++ "b/src/boj/G5_11509_\355\222\215\354\204\240_\353\247\236\354\266\224\352\270\260.kt" @@ -0,0 +1,27 @@ +package boj + +class BOJ11509() { + + lateinit var balloons: MutableList + + fun solve() { + val n = readln().toInt() + balloons = readln().split(" ").map { it.toInt() }.toMutableList() + val arrows = mutableListOf() + for (i in 0 until n) { + val balloonHeight = balloons[i] + val arrowIndex = arrows.indexOf(balloonHeight) + if (arrowIndex >= 0) { + arrows[arrowIndex]-- + } else { + arrows.add(balloonHeight - 1) + } + } + + print(arrows.size) + } +} + +fun main() { + BOJ11509().solve() +} \ No newline at end of file