From 91e5984cb0251fd8ca1c9fff4c26f6777aa2bffb Mon Sep 17 00:00:00 2001 From: SeongHoonC Date: Mon, 8 Jul 2024 20:48:53 +0900 Subject: [PATCH] 2024-07-08 solved --- SeongHoonC/README.md | 2 +- ...70\353\247\214\353\223\244\352\270\260.kt" | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 "SeongHoonC/\353\270\214\353\243\250\355\212\270\355\217\254\354\212\244/\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.kt" diff --git a/SeongHoonC/README.md b/SeongHoonC/README.md index 8e21e2d0..2ffc9642 100644 --- a/SeongHoonC/README.md +++ b/SeongHoonC/README.md @@ -31,5 +31,5 @@ | 27차시 | 2024.05.30 | 그래프 | 피리 부는 사나이 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/201 | | 28차시 | 2024.06.03 | 투포인터 | 부분합 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/205 | | 29차시 | 2024.07.01 | 구현, 그래프 | 서울의 지하철 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/213 | - +| 30차시 | 2024.07.08 | 브루트포스 | 암호 만들기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/215 | --- diff --git "a/SeongHoonC/\353\270\214\353\243\250\355\212\270\355\217\254\354\212\244/\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.kt" "b/SeongHoonC/\353\270\214\353\243\250\355\212\270\355\217\254\354\212\244/\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.kt" new file mode 100644 index 00000000..154e5caf --- /dev/null +++ "b/SeongHoonC/\353\270\214\353\243\250\355\212\270\355\217\254\354\212\244/\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.kt" @@ -0,0 +1,24 @@ +private lateinit var letters: List + +fun main() { + val br = System.`in`.bufferedReader() + val (l, c) = br.readLine().split(" ").map { it.toInt() } + letters = br.readLine().split(" ").sorted() + + for (i in 0..c - l) { + dfs(i, letters[i], l) + } +} + +private fun dfs(index: Int, word: String, l: Int) { + if (word.length == l) { + val counts = "aeiou".toList().count { word.contains(it) } + if (counts > 0 && l - counts > 1) { + println(word) + } + return + } + for (i in index + 1 until letters.size) { + dfs(i, word + letters[i], l) + } +} \ No newline at end of file