From 17b9d16e7ce3101a888ba25cb8cdb142a761c5ef Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 18 Nov 2025 23:35:46 +0900 Subject: [PATCH] =?UTF-8?q?[20251118]=20PGM=20/=20LV2=20/=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=AA=85=20=EC=A0=95=EB=A0=AC=20/=20=EA=B6=8C?= =?UTF-8?q?=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\353\252\205 \354\240\225\353\240\254.md" | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 "khj20006/202511/18 PGM LV2 \355\214\214\354\235\274\353\252\205 \354\240\225\353\240\254.md" diff --git "a/khj20006/202511/18 PGM LV2 \355\214\214\354\235\274\353\252\205 \354\240\225\353\240\254.md" "b/khj20006/202511/18 PGM LV2 \355\214\214\354\235\274\353\252\205 \354\240\225\353\240\254.md" new file mode 100644 index 00000000..e636f2a9 --- /dev/null +++ "b/khj20006/202511/18 PGM LV2 \355\214\214\354\235\274\353\252\205 \354\240\225\353\240\254.md" @@ -0,0 +1,51 @@ +```cpp +#include +using namespace std; + +class CustomString { +public: + string str, head; + int number, order; + CustomString(string a, int ord) { + this->str = a; + this->order = ord; + int idx = 0; + this->head = ""; + string num = ""; + while (idx < a.size()) { + if ('0' <= a[idx] && a[idx] <= '9') { + num += a[idx]; + } + else { + if (!num.empty()) break; + if ('A' <= a[idx] && a[idx] <= 'Z') head += (char)(a[idx] + 32); + else head += a[idx]; + } + idx++; + } + this->number = stoi(num); + } +}; + + +vector solution(vector files) { + vector customFiles; + int ord = 0; + for (string file : files) { + customFiles.push_back(new CustomString(file, ++ord)); + } + + sort(customFiles.begin(), customFiles.end(), [](CustomString* a, CustomString* b) -> bool { + if (a->head != b->head) return a->head < b->head; + if (a->number != b->number) return a->number < b->number; + return a->order < b->order; + }); + + vector answer; + for (CustomString* cs : customFiles) { + answer.push_back(cs->str); + } + + return answer; +} +```