diff --git "a/src/6week/seoyoon/\353\217\231\354\240\204 0.kt" "b/src/6week/seoyoon/\353\217\231\354\240\204 0.kt" new file mode 100644 index 0000000..cc1230d --- /dev/null +++ "b/src/6week/seoyoon/\353\217\231\354\240\204 0.kt" @@ -0,0 +1,13 @@ +package `6week`.seoyoon + +fun main() { + var (N, K) = readln().split(" ").map{ it.toInt() } + val coin = IntArray(N) { readln().toInt() } + var cnt = 0 + + for (i in N - 1 downTo 0) { + cnt += K / coin[i] + K = K % coin[i] + } + println(cnt) +} \ No newline at end of file diff --git "a/src/6week/seoyoon/\354\210\230\353\246\254\352\263\265 \355\225\255\354\212\271.kt" "b/src/6week/seoyoon/\354\210\230\353\246\254\352\263\265 \355\225\255\354\212\271.kt" new file mode 100644 index 0000000..16015eb --- /dev/null +++ "b/src/6week/seoyoon/\354\210\230\353\246\254\352\263\265 \355\225\255\354\212\271.kt" @@ -0,0 +1,18 @@ +package `6week`.seoyoon + +fun main() { + val (N, L) = readln().split(" ").map{ it.toInt() } + val water = readln().split(" ").map{ it.toInt() }.toIntArray() + var cnt = 1 + + water.sort() + var tape = water[0] + L - 0.5 + + for (i in 1 until N) { + if (tape < water[i]) { + cnt++ + tape = water[i] + L - 0.5 + } + } + println(cnt) +} \ No newline at end of file diff --git "a/src/6week/seoyoon/\354\213\240\354\236\205 \354\202\254\354\233\220.kt" "b/src/6week/seoyoon/\354\213\240\354\236\205 \354\202\254\354\233\220.kt" new file mode 100644 index 0000000..e785247 --- /dev/null +++ "b/src/6week/seoyoon/\354\213\240\354\236\205 \354\202\254\354\233\220.kt" @@ -0,0 +1,24 @@ +package `6week`.seoyoon + +fun main() { + val T = readln().toInt() + repeat(T) { + val N = readln().toInt() + val rank = Array(N, { IntArray(2) }) + var cnt = 1 + + repeat(N) { + rank[it] = readln().split(" ").map{ it.toInt() }.toIntArray() + } + var sorted = rank.sortedBy{ it.first() } + + var compare = sorted[0][1] + repeat(N) { + if (sorted[it][1] < compare) { + cnt++ + compare = sorted[it][1] + } + } + println(cnt) + } +} \ No newline at end of file diff --git "a/src/6week/seoyoon/\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270.kt" "b/src/6week/seoyoon/\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270.kt" new file mode 100644 index 0000000..2dfd534 --- /dev/null +++ "b/src/6week/seoyoon/\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270.kt" @@ -0,0 +1,14 @@ +package `6week`.seoyoon + +fun main() { + var answer = 0 + val str = readln().split("-").toMutableList() + repeat(str.size) { + if (str[it].contains("+")) { + var midSum = str[it].split("+").map{ it.toInt() }.reduce{total, sum -> total + sum} + str[it] = midSum.toString() + } + } + answer = str.map{ it.toInt() }.reduce{ total, sum -> total - sum } + println(answer) +} \ No newline at end of file diff --git "a/src/6week/seoyoon/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260.kt" "b/src/6week/seoyoon/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260.kt" new file mode 100644 index 0000000..0007ca1 --- /dev/null +++ "b/src/6week/seoyoon/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260.kt" @@ -0,0 +1,38 @@ +package `6week`.seoyoon + +class `큰 수 만들기` { + companion object { + fun getSolution(): Solution { + return Solution() + } + } + + class Solution { + fun solution(number: String, k: Int): String { + var answer = StringBuilder() + var idx = 0 + + for (i in 0 until number.length) { + if (answer.length == number.length - k) { + return answer.toString() + } + var max = 0 + for (j in idx .. k + i) { + if (number[j].digitToInt() > max) { + max = number[j].digitToInt() + idx = j + 1 + } + } + answer.append(max) + } + return answer.toString() + } + } +} + +fun main() { + val solution = `큰 수 만들기`.getSolution() + println(solution.solution("1924", 2)) + println(solution.solution("1231234", 3)) + println(solution.solution("4177252841", 4)) +} \ No newline at end of file