From 578e2b9471f37119c49963998b7568a86904e918 Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Mon, 19 Jan 2026 22:57:59 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[Week2]=20BOJ=201965:=20=EC=83=81=EC=9E=90?= =?UTF-8?q?=EB=84=A3=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Hexeong.cpp" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" diff --git "a/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" "b/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" new file mode 100644 index 0000000..d3d0450 --- /dev/null +++ "b/weekly/week02/BOJ_1965_\354\203\201\354\236\220\353\204\243\352\270\260/Hexeong.cpp" @@ -0,0 +1,35 @@ +// +// Created by hex on 26. 1. 19.. +// + +#include +#include + +using namespace std; + +int main() { + ios::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + int n; cin >> n; + vector arr(n); + vector dp(n, 1); + + for (int i = 0; i < n; i++) + cin >> arr[i]; + + int max_v = 1; + for (int i = 0; i < n; i++) { + for (int j = 0; j < i; j++) { + if (arr[j] < arr[i]) { + dp[i] = max(dp[i], dp[j] + 1); + } + } + max_v = max(max_v, dp[i]); + } + + cout << max_v << endl; + + return 0; +} \ No newline at end of file From cd6f45809970c0452b41f2052510fcb9d14494c4 Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Sat, 14 Mar 2026 18:19:51 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[Week10]=20BOJ=2012919:=20A=EC=99=80=20B=20?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 13 +++++++ .../BOJ_12919_A\354\231\200B2/Hexeong.java" | 38 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 "weekly/week10/BOJ_12919_A\354\231\200B2/Hexeong.java" diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a0193bd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.10) + +# 1. 프로젝트 이름 설정 (원하는 이름으로 변경 가능) +project(MyProject) + +# 2. C++ 표준 설정 (C++11, 14, 17, 20 중 선택) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# 3. 실행 파일 생성 +# add_executable(실행파일명 소스파일.cpp) +# 예: main.cpp를 컴파일하여 my_program이라는 실행 파일을 만듦 +add_executable(my_program /weekly/week02/BOJ_1965_상자넣기/Hexeong.cpp) \ No newline at end of file diff --git "a/weekly/week10/BOJ_12919_A\354\231\200B2/Hexeong.java" "b/weekly/week10/BOJ_12919_A\354\231\200B2/Hexeong.java" new file mode 100644 index 0000000..2d2084d --- /dev/null +++ "b/weekly/week10/BOJ_12919_A\354\231\200B2/Hexeong.java" @@ -0,0 +1,38 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class Main { + // AI의 피드백 : SB를 1개로 유지하고 process가 끝난 이후 원상태로 복구하는 방식으로 최적화하자. + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + String S = br.readLine(); + String T = br.readLine(); + + StringBuilder sb = new StringBuilder(T); + + System.out.println(process(sb, S) ? 1 : 0); + } + + private static boolean process(StringBuilder sb, String S) { + if (sb.toString().equals(S)) { + return true; + } + if (sb.length() <= S.length()) { + return false; + } + + if (sb.charAt(sb.length() - 1) == 'A' && process(removeAtoSb(sb), S)) { + return true; + } + return sb.charAt(0) == 'B' && process(reverseAndDeleteBtoSb(sb), S); + }; + + private static StringBuilder removeAtoSb(StringBuilder sb) { + return new StringBuilder(sb).deleteCharAt((sb.length() - 1)); + } + + private static StringBuilder reverseAndDeleteBtoSb(StringBuilder sb) { + return new StringBuilder(sb).reverse().deleteCharAt((sb.length() - 1)); + } +} From 749a6fd53c1cc73aed21c63efc999eba2fd39d9c Mon Sep 17 00:00:00 2001 From: Hexeong <123macanic@naver.com> Date: Sat, 14 Mar 2026 18:26:56 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[Week10]=20BOJ=2020055:=20=EC=BB=A8?= =?UTF-8?q?=EB=B2=A0=EC=9D=B4=EC=96=B4=20=EB=B2=A8=ED=8A=B8=20=EC=9C=84?= =?UTF-8?q?=EC=9D=98=20=EB=A1=9C=EB=B4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Hexeong.java" | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 "weekly/week10/BOJ_20055_\354\273\250\353\262\240\354\235\264\354\226\264\353\262\250\355\212\270\354\234\204\354\235\230\353\241\234\353\264\207/Hexeong.java" diff --git "a/weekly/week10/BOJ_20055_\354\273\250\353\262\240\354\235\264\354\226\264\353\262\250\355\212\270\354\234\204\354\235\230\353\241\234\353\264\207/Hexeong.java" "b/weekly/week10/BOJ_20055_\354\273\250\353\262\240\354\235\264\354\226\264\353\262\250\355\212\270\354\234\204\354\235\230\353\241\234\353\264\207/Hexeong.java" new file mode 100644 index 0000000..6bf3ce2 --- /dev/null +++ "b/weekly/week10/BOJ_20055_\354\273\250\353\262\240\354\235\264\354\226\264\353\262\250\355\212\270\354\234\204\354\235\230\353\241\234\353\264\207/Hexeong.java" @@ -0,0 +1,94 @@ +package com.hexeong.baekjoon; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.*; + +public class Main { + // AI의 피드백 : Wrapper 클래스 사용을 지양하자. + // 또한, 코테에서는 클래스의 멤버 메서드 사용하지 말고 배열을 직접 조작하는 방식을 사용하자. + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + StringTokenizer st = new StringTokenizer(br.readLine()); + int N = Integer.parseInt(st.nextToken()); + int K = Integer.parseInt(st.nextToken()); + + Section[] belt = new Section[2 * N]; + st = new StringTokenizer(br.readLine()); + for (int i = 0; i < 2 * N; i++) { + belt[i] = new Section(false, Integer.parseInt(st.nextToken())); + } + + int round = 0; + int cntZeroSection = 0; + int startIdx = 0; + while (cntZeroSection < K) { + round++; + + // 1. 로봇과 함께 회전 + startIdx = (startIdx - 1 + 2 * N) % (2 * N); + int loweridx = (startIdx + N - 1) % (2 * N); + belt[loweridx].setRobotExists(false); + + // 2. N-2부터 0까지 앞으로 1칸 이동 + int targetIdx = (startIdx + N - 2) % (2 * N); + int endIdx = startIdx - 1 < 0 ? 2 * N - 1 : startIdx - 1; + for (int curIdx = targetIdx; curIdx != endIdx; curIdx = (curIdx == 0 ? 2 * N - 1 : curIdx - 1)) { + int nextIdx = (curIdx + 1) % (2 * N); + if (belt[curIdx].getRobotExists() + && !belt[nextIdx].getRobotExists() + && belt[nextIdx].getDurability() > 0) { + + belt[nextIdx].setRobotExists(true); + belt[nextIdx].setDurability(belt[nextIdx].getDurability() - 1); + belt[curIdx].setRobotExists(false); + + // 2-1. 내구도가 0이 됐으면 cntZeroSection += 1; + if (belt[nextIdx].getDurability() == 0) + cntZeroSection++; + + if (nextIdx == loweridx) { // N-1 위치에 로봇이 오면 즉시 내린다. + belt[nextIdx].setRobotExists(false); + } + } + } + + // 3. 올리는 위치에 있는 칸의 내구도가 0이 아니라면 올리는 위치에 로봇을 올리기 + if (belt[startIdx].getDurability() > 0) { + belt[startIdx].setRobotExists(true); + belt[startIdx].setDurability(belt[startIdx].getDurability() - 1); + // 3-1. 내구도가 0이 됐으면 cntZeroSection += 1; + if (belt[startIdx].getDurability() == 0) + cntZeroSection++; + } + } + + System.out.println(round); + } + + static class Section { + private Boolean isRobotExists; + private Integer durability; + public Section(boolean isRobotExists, Integer durability) { + this.isRobotExists = isRobotExists; + this.durability = durability; + } + + public Boolean getRobotExists() { + return isRobotExists; + } + + public Integer getDurability() { + return durability; + } + + public void setRobotExists(Boolean robotExists) { + isRobotExists = robotExists; + } + + public void setDurability(Integer durability) { + this.durability = durability; + } + } +}