백준 - 1021 회전하는 큐
문제 1021 회전하는 큐 답 kotlin code fun main() { q1021() } fun q1021() { val queue = CircleQueue() queue.addAllElementsOneToN(readln().split(" ").first().toInt()) val dequeueElements = ...
문제 1021 회전하는 큐 답 kotlin code fun main() { q1021() } fun q1021() { val queue = CircleQueue() queue.addAllElementsOneToN(readln().split(" ").first().toInt()) val dequeueElements = ...
문제 5430 AC 답 kotlin code fun main() { q5430() } fun q5430() { val caseCount = readln().toInt() val orders = Array(caseCount) { Order() } orders.forEach { it.execOrder() } } clas...
문제 2606 바이러스 답 kotlin code fun main() { q2606() } fun q2606() { val input:Network = readNetwork() val sickComputers = getSickComputers(input) println(sickComputers.count() - 1)...
문제 25083 새싹 답 kotlin code fun main() { q25083() } fun q25083() { println(" ,r'\"7") println("r`-_ ,' ,/") println(" \\. \". L_r'") println(" `~\\/") println(...
문제 9020 골드바흐의 추측 답 kotlin code fun main() { q9020() } fun q9020() { val inputs = IntArray(readln().toInt()) { readln().toInt() } for(input in inputs) { for(n1 in input/2 dow...
문제 11653 소인수분해 답 kotlin code fun main() { q11653() } fun q11653() { var input = readln().toInt() val minimumPrimeNumber = 2 for(i in minimumPrimeNumber..input) { while (...
문제 1085 직사각형에서 탈출 답 kotlin code fun main() { q1085() } fun q1085() { val (x, y, w, h) = readln().split(" ").map { it.toInt() } println(arrayOf(x, y, w-x, h-y).minOf { it }) }
문제 10872 팩토리얼 답 kotlin code fun main() { q10872() } fun q10872() { val n = readln().toInt() println(factorial(n)) } tailrec fun factorial(n:Int, acc:Int = 1): Int = when(n){ 0 -...
문제 10870 피보나치 수 5 답 1. kotlin code: 재귀 fun main() { q10870() } fun q10870() { val n = readln().toInt() println(fibonacci(n)) } fun fibonacci(n: Int): Int = when(n) { 0, 1 ->...
문제 2775 부녀회장이 될테야 풀이 층\호 1 2 3 2 1 4 10 1 1 3 6 0 1 2 3 답 kotlin code fun main() { q2775() } fun q2...