<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>happy_lee0_0.log</title>
        <link>https://velog.io/</link>
        <description>#자기공부 #틀린것도많음 #자기개발 여러분 인생이 힘들다 하더라도 그것을 깨는 순간 큰 희열감으로 옵니다~</description>
        <lastBuildDate>Fri, 20 Mar 2026 00:39:55 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>happy_lee0_0.log</title>
            <url>https://velog.velcdn.com/images/happy_lee0_0/profile/730560aa-03c4-4ab3-9e65-81b1710ecdb1/image.jpg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. happy_lee0_0.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/happy_lee0_0" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[건설업 관련 꿀직업]]></title>
            <link>https://velog.io/@happy_lee0_0/%EA%B1%B4%EC%84%A4%EC%97%85-%EA%B4%80%EB%A0%A8-%EA%BF%80%EC%A7%81%EC%97%85</link>
            <guid>https://velog.io/@happy_lee0_0/%EA%B1%B4%EC%84%A4%EC%97%85-%EA%B4%80%EB%A0%A8-%EA%BF%80%EC%A7%81%EC%97%85</guid>
            <pubDate>Fri, 20 Mar 2026 00:39:55 GMT</pubDate>
            <description><![CDATA[<ol>
<li>불보고 불이 날 것 같은지 확인하는 작업</li>
</ol>
<p>→ 화재감시자 (Fire Watcher)</p>
<p>용접·용단 등 화기 작업 시 화재 발생 여부를 감시</p>
<p>잔불 및 불꽃 비산 여부 확인</p>
<ol start="2">
<li>야광봉을 들고 흔들면서 길 안내하는 사람</li>
</ol>
<p>→ 신호수 (Flagman / Traffic Controller)</p>
<p>차량 및 장비 이동 시 신호를 통해 안전 유도</p>
<p>야간에는 야광봉(라이트 배턴) 사용</p>
<ol start="3">
<li>사람을 보고 따라오라고 안내하는 사람</li>
</ol>
<p>→ 유도원 (Guide / Banksman)</p>
<p>작업자 또는 장비를 특정 위치까지 안전하게 유도</p>
<p>협소 공간, 후진 작업 등에서 필수 역할</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[4 - 1,2. 이 세상은 객체로 이루어져 있다 / 클래스의 세계로 오신 것을 환영합니다. (함수의 오버로딩, 생성자)  ]]></title>
            <link>https://velog.io/@happy_lee0_0/4-12.-%EC%9D%B4-%EC%84%B8%EC%83%81%EC%9D%80-%EA%B0%9D%EC%B2%B4%EB%A1%9C-%EC%9D%B4%EB%A3%A8%EC%96%B4%EC%A0%B8-%EC%9E%88%EB%8B%A4-%ED%81%B4%EB%9E%98%EC%8A%A4%EC%9D%98-%EC%84%B8%EA%B3%84%EB%A1%9C-%EC%98%A4%EC%8B%A0-%EA%B2%83%EC%9D%84-%ED%99%98%EC%98%81%ED%95%A9%EB%8B%88%EB%8B%A4.-%ED%95%A8%EC%88%98%EC%9D%98-%EC%98%A4%EB%B2%84%EB%A1%9C%EB%94%A9-%EC%83%9D%EC%84%B1%EC%9E%90</link>
            <guid>https://velog.io/@happy_lee0_0/4-12.-%EC%9D%B4-%EC%84%B8%EC%83%81%EC%9D%80-%EA%B0%9D%EC%B2%B4%EB%A1%9C-%EC%9D%B4%EB%A3%A8%EC%96%B4%EC%A0%B8-%EC%9E%88%EB%8B%A4-%ED%81%B4%EB%9E%98%EC%8A%A4%EC%9D%98-%EC%84%B8%EA%B3%84%EB%A1%9C-%EC%98%A4%EC%8B%A0-%EA%B2%83%EC%9D%84-%ED%99%98%EC%98%81%ED%95%A9%EB%8B%88%EB%8B%A4.-%ED%95%A8%EC%88%98%EC%9D%98-%EC%98%A4%EB%B2%84%EB%A1%9C%EB%94%A9-%EC%83%9D%EC%84%B1%EC%9E%90</guid>
            <pubDate>Wed, 18 Mar 2026 23:14:11 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>해당 내용은 씹어먹는 C++ 책을 기반으로 하단 블로그의 내용을 공부하기위해 적성한 글임을 알립니다.</p>
</blockquote>
<h1 id="4---1-이-세상은-객체로-이루어져-있다">4 - 1. 이 세상은 객체로 이루어져 있다</h1>
<h2 id="객체란">객체란</h2>
<pre><code>typedef struct Animal {
  char name[30];  // 이름
  int age;        // 나이

  int health;  // 체력
  int food;    // 배부른 정도
  int clean;   // 깨끗한 정도
} Animal;</code></pre><ul>
<li><p>전에 작성한  Animal 구조체를 정의한 후, animal 변수를 만들어서 이를 필요로 하는 함수를 작성함</p>
</li>
<li><p>이 때 객체가 현실 세계에서의 존재하는 것들을 나타내기 위해서는 추상화(abstraction)라는 과정이 필요</p>
</li>
<li><p>animal.food += 100; 자체는 외부에서 animal 이라는 &#39;객체&#39; 의 &#39;인스턴스 변수&#39; 에 &#39;직접&#39; 접근하는 것이기 때문에 불가능</p>
</li>
<li><p>animal.increase_food(100); 의 경우 animal 객체의 &#39;인스턴스 함수&#39; 를 통해서 값을 수정하는 것이기 때문에가능한 것이지요. 이와 같이 외부에서 직접 인스턴스 변수의 값을 바꿀 수 없고 항상 인스턴스 메소드를 통해서 간접적으로 조절하는 것을 캡슐화(Encapsulation)라고 함</p>
</li>
</ul>
<hr>
<h2 id="클래스란">클래스란</h2>
<pre><code>class Animal {
 private:
  int food;
  int weight;

 public:
  void set_animal(int _food, int _weight) {
    food = _food;
    weight = _weight;
  }
  void increase_food(int inc) {
    food += inc;
    weight += (inc / 3);
  }
  void view_stat() {
    std::cout &lt;&lt; &quot;이 동물의 food   : &quot; &lt;&lt; food &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;이 동물의 weight : &quot; &lt;&lt; weight &lt;&lt; std::endl;
  }
};</code></pre><ul>
<li>Animal 클래스 상에서 이들을 지칭할 때 각각 멤버 변수(member variable) 과 멤버 함수(member function) 라고 부름</li>
</ul>
<pre><code>private:
int food;
int weight;</code></pre><ul>
<li>아래에 쓰여진 것들은 모두 객체 내에서 보호되고 있다 라는 의미</li>
<li>모든 것들은 자기 객체 안에서만 접근할 수 있을 뿐 객체 외부에서는 접근할 수 없게 됨</li>
</ul>
<pre><code>public:
void set_animal(int _food, int _weight) {
  food = _food;
  weight = _weight;
}
void increase_food(int inc) {
  food += inc;
  weight += (inc / 3);
}
void view_stat() {
  std::cout &lt;&lt; &quot;이 동물의 food   : &quot; &lt;&lt; food &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;이 동물의 weight : &quot; &lt;&lt; weight &lt;&lt; std::endl;
}</code></pre><ul>
<li>public 이라는 것은 말 그대로 공개된 것으로 외부에서 마음껏 이용할 수 있게 됨<pre><code>animal.set_animal(100, 50);
animal.increase_food(30);
animal.view_stat();</code></pre></li>
<li>이런식으로 다 지원하게 됨</li>
<li>만일 멤버 함수들을 private 로 설정해버렸다면 어떨까요. public 키워드를 지워봄<blockquote>
<p>&#39;Animal::set_animal&#39; : cannot access private member declared in class &#39;Animal&#39;</p>
</blockquote>
</li>
</ul>
<p>이런 에러가 발생</p>
<pre><code>class Animal {
  int food;
  int weight;
  // ... 생략</code></pre><ul>
<li>이런식으로 작성하면 다 private으로 작성하게됨</li>
</ul>
<h1 id="4---2-클래스의-세계로-오신-것을-환영합니다-함수의-오버로딩-생성자">4 - 2. 클래스의 세계로 오신 것을 환영합니다. (함수의 오버로딩, 생성자)</h1>
<h2 id="함수의-오버로딩-overloading">함수의 오버로딩 (Overloading)</h2>
<ol>
<li><p>과적하다</p>
</li>
<li><p>sb (with sth) 너무 많이 주다[부과하다]</p>
</li>
<li><p>(컴퓨터・전기 시스템 등에) 과부하가 걸리게 하다 </p>
</li>
</ol>
<p>이런뜻으로 들어감</p>
<pre><code>/* 함수의 오버로딩 */
#include &lt;iostream&gt;

void print(int x) { std::cout &lt;&lt; &quot;int : &quot; &lt;&lt; x &lt;&lt; std::endl; }
void print(char x) { std::cout &lt;&lt; &quot;char : &quot; &lt;&lt; x &lt;&lt; std::endl; }
void print(double x) { std::cout &lt;&lt; &quot;double : &quot; &lt;&lt; x &lt;&lt; std::endl; }

int main() {
  int a = 1;
  char b = &#39;c&#39;;
  double c = 3.2f;

  print(a);
  print(b);
  print(c);

  return 0;
}</code></pre><ul>
<li>해당 코드에서 신기한 점은 함수의 이름이 동일하다는것임</li>
<li>하지만 해당것은 오류가 안나오고 코드가 compile 됨</li>
</ul>
<p>하지만</p>
<pre><code>/* 함수의 오버로딩 */
#include &lt;iostream&gt;

void print(int x) { std::cout &lt;&lt; &quot;int : &quot; &lt;&lt; x &lt;&lt; std::endl; }
void print(double x) { std::cout &lt;&lt; &quot;double : &quot; &lt;&lt; x &lt;&lt; std::endl; }

int main() {
  int a = 1;
  char b = &#39;c&#39;;
  double c = 3.2f;

  print(a);
  print(b);
  print(c);

  return 0;
}</code></pre><p>이는 지금 print로 int와 double로 두개의 함수를 작성하지만 main함수에서는 char가 있음 이에 결과는 </p>
<blockquote>
<p>int : 1
int : 99
double : 3.2</p>
</blockquote>
<p>이상하게 결과가 나옴</p>
<p>오버로딩의 과정 같은 경우</p>
<ul>
<li><p>1 단계
자신과 타입이 정확히 일치하는 함수를 찾음</p>
</li>
<li><p>2 단계
정확히 일치하는 타입이 없는 경우 아래와 같은 형변환을 통해서 일치하는 함수를 찾아봄</p>
<p>Char, unsigned char, short 는 int 로 변한왐</p>
<p>Unsigned short 는 int 의 크기에 따라 int 혹은 unsigned int 로 변환됨</p>
<p>Float 은 double 로 변환됨</p>
<p>Enum 은 int 로 변환됨</p>
</li>
<li><p>3 단계
위와 같이 변환해도 일치하는 것이 없다면 아래의 좀더 포괄적인 형변환을 통해 일치하는 함수를 찾음</p>
<p>임의의 숫자(numeric) 타입은 다른 숫자 타입으로 변환됨 
ex) float -&gt; int</p>
<p>Enum 도 임의의 숫자 타입으로 변환ehla ex) Enum -&gt; double</p>
<p>0 은 포인터 타입이나 숫자 타입으로 변환된 0 은 포인터 타입이나 숫자 타입으로 변환됨</p>
<p>포인터는 void 포인터로 변환됨</p>
</li>
<li><p>4 단계
유저 정의된 타입 변환으로 일치하는 것을 찾음 </p>
</li>
</ul>
<p>(만약에 컴파일러가 위 과정을 통하더라도 일치하는 함수를 찾을 수 없거나 같은 단계에서 두 개 이상이 일치하는 경우에 모호하다 (ambiguous) 라고 판단해서 오류를 발생하게 됨)</p>
<pre><code>// 모호한 오버로딩
#include &lt;iostream&gt;

void print(int x) { std::cout &lt;&lt; &quot;int : &quot; &lt;&lt; x &lt;&lt; std::endl; }
void print(char x) { std::cout &lt;&lt; &quot;double : &quot; &lt;&lt; x &lt;&lt; std::endl; }

int main() {
  int a = 1;
  char b = &#39;c&#39;;
  double c = 3.2f;

  print(a);
  print(b);
  print(c);

  return 0;
}</code></pre><blockquote>
<p> error C2668: &#39;print&#39; : ambiguous call to overloaded function
 could be &#39;void print(char)&#39;
 or       &#39;void print(int)&#39;
while trying to match the argument list &#39;(double)&#39;</p>
</blockquote>
<ul>
<li>일단 위 소스에서는 함수가 print (int x) 와 print (char x) 밖에 없으므로 관건은 print(c); 를 했을 때 어떠한 함수가 호출되어야 하는지 결정하는 것인데요, print(c) 를 했을 때 1 단계에서는 명백하게 일치하는 것이 없음</li>
<li>그래서 아무것도 없어서 오류가 나옴</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[3. C++ 의 세계로 오신 것을 환영합니다. (new, delete)]]></title>
            <link>https://velog.io/@happy_lee0_0/3.-C-%EC%9D%98-%EC%84%B8%EA%B3%84%EB%A1%9C-%EC%98%A4%EC%8B%A0-%EA%B2%83%EC%9D%84-%ED%99%98%EC%98%81%ED%95%A9%EB%8B%88%EB%8B%A4.-new-delete</link>
            <guid>https://velog.io/@happy_lee0_0/3.-C-%EC%9D%98-%EC%84%B8%EA%B3%84%EB%A1%9C-%EC%98%A4%EC%8B%A0-%EA%B2%83%EC%9D%84-%ED%99%98%EC%98%81%ED%95%A9%EB%8B%88%EB%8B%A4.-new-delete</guid>
            <pubDate>Wed, 18 Mar 2026 22:50:28 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>해당 내용은 씹어먹는 C++ 책을 기반으로 하단 블로그의 내용을 공부하기위해 적성한 글임을 알립니다.</p>
</blockquote>
<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/cae7e275-c8a1-4551-a4ee-7e7c7c169603/image.png" alt=""></p>
<h3 id="힙">힙</h3>
<ul>
<li>동적으로 할당된 변수가 할당되는 영역(Dynamic Memory Allocation)</li>
<li>프로그래머가 직접 공간을 할당, 해제하는 메모리 공간</li>
</ul>
<h3 id="스택">스택</h3>
<ul>
<li>프로그램이 자동으로 사용하는 임시 메모리 영역</li>
</ul>
<hr>
<ul>
<li><p>함수 호출 시 생성되는 지역 변수와 매개 변수가 저장되는 영역으로, 함수 호출이 완료되면 저장된 메모리도 해제됨</p>
</li>
<li><p>C 언어에서는 malloc 과 free 함수를 지원하여 힙 상에서의 메모리 할당을 지원함</p>
</li>
<li><p>C++ 에서도 마찬가지로 malloc 과 free 함수를 사용할 수 있는데 그것은  언어 차원에서 지원하는 것으로 바로 new 와 delete 라고 할 수 있음</p>
</li>
</ul>
<p><strong>new(동적 메모리 할당)</strong></p>
<ul>
<li>프로그램 실행 중에 heap 영역에 메모리를 할당</li>
<li>할당된 메모리의 <strong>주소(pointer)</strong>를 반환</li>
</ul>
<p><strong>delete (동적 메모리 해제)</strong></p>
<ul>
<li>new로 할당한 메모리를 반드시 해제</li>
<li>해제하지 않으면 → 메모리 누수(memory leak) 발생</li>
</ul>
<pre><code>/* new 와 delete 의 사용 */
#include &lt;iostream&gt;

int main() {
  int* p = new int;
  *p = 10;

  std::cout &lt;&lt; *p &lt;&lt; std::endl;

  delete p;
  return 0;
}</code></pre><h3 id="사용방법">사용방법</h3>
<p>int* p = new int; 로 p 에 집어 넣었음을 알 수 있음
T* pointer = new T; 에 T 에는 임의의 타입이 들어가고 *p = 10;
를 통해서 값을 집어넣었고 이를 출력함</p>
<p>위와 같이 delete p 를 하게 되면 p 에 할당된 공간이 해제 가능 </p>
<p>delete 로 해제할 수 있는 메모리 공간은 사용자가 new 를 통해서 할당한 공간만 가능</p>
<pre><code>/* 지역 변수 delete 하기 */
#include &lt;iostream&gt;

int main() {
  int a = 5;

  delete &amp;a;

  return 0;
}</code></pre><p> 이런경우 delete 로 해제해버리려 한다면 Heap 이 아닌 공간을 해제하려고 한다는 경고 메세지가 나타나게 됨</p>
<pre><code>/* new 로 배열 할당하기 */

#include &lt;iostream&gt;

int main() {
  int arr_size;
  std::cout &lt;&lt; &quot;array size : &quot;;
  std::cin &gt;&gt; arr_size;
  int *list = new int[arr_size];
  for (int i = 0; i &lt; arr_size; i++) {
    std::cin &gt;&gt; list[i];
  }
  for (int i = 0; i &lt; arr_size; i++) {
    std::cout &lt;&lt; i &lt;&lt; &quot;th element of list : &quot; &lt;&lt; list[i] &lt;&lt; std::endl;
  }
  delete[] list;
  return 0;
}</code></pre><ul>
<li>*list = new int[arr_size]; 해당것은 이걸로 new로 힙에 메모리를 할당한것을 주소로 반환한것을 포인터에 저장한것</li>
</ul>
<hr>
<pre><code>#include &lt;iostream&gt;

typedef struct Animal {
  char name[30];  // 이름
  int age;        // 나이

  int health;  // 체력
  int food;    // 배부른 정도
  int clean;   // 깨끗한 정도
} Animal;

void create_animal(Animal *animal) {
  std::cout &lt;&lt; &quot;동물의 이름? &quot;;
  std::cin &gt;&gt; animal-&gt;name;

  std::cout &lt;&lt; &quot;동물의 나이? &quot;;
  std::cin &gt;&gt; animal-&gt;age;

  animal-&gt;health = 100;
  animal-&gt;food = 100;
  animal-&gt;clean = 100;
}

void play(Animal *animal) {
  animal-&gt;health += 10;
  animal-&gt;food -= 20;
  animal-&gt;clean -= 30;
}
void one_day_pass(Animal *animal) {
  // 하루가 지나면
  animal-&gt;health -= 10;
  animal-&gt;food -= 30;
  animal-&gt;clean -= 20;
}
void show_stat(Animal *animal) {
  std::cout &lt;&lt; animal-&gt;name &lt;&lt; &quot;의 상태&quot; &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;체력    : &quot; &lt;&lt; animal-&gt;health &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;배부름 : &quot; &lt;&lt; animal-&gt;food &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;청결    : &quot; &lt;&lt; animal-&gt;clean &lt;&lt; std::endl;
}
int main() {
  Animal *list[10];
  int animal_num = 0;

  for (;;) {
    std::cout &lt;&lt; &quot;1. 동물 추가하기&quot; &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;2. 놀기 &quot; &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;3. 상태 보기 &quot; &lt;&lt; std::endl;

    int input;
    std::cin &gt;&gt; input;

    switch (input) {
      int play_with;
      case 1:
        list[animal_num] = new Animal;
        create_animal(list[animal_num]);

        animal_num++;
        break;
      case 2:
        std::cout &lt;&lt; &quot;누구랑 놀게? : &quot;;
        std::cin &gt;&gt; play_with;

        if (play_with &lt; animal_num) play(list[play_with]);

        break;

      case 3:
        std::cout &lt;&lt; &quot;누구껄 보게? : &quot;;
        std::cin &gt;&gt; play_with;
        if (play_with &lt; animal_num) show_stat(list[play_with]);
        break;
    }

    for (int i = 0; i != animal_num; i++) {
      one_day_pass(list[i]);
    }
  }
  for (int i = 0; i != animal_num; i++) {
    delete list[i];
  }
}</code></pre><ul>
<li>해당것은 동물 관련으로 진행하는 미니게임 형식임</li>
</ul>
<pre><code>typedef struct Animal {
  char name[30];  // 이름
  int age;        // 나이

  int health;  // 체력
  int food;    // 배부른 정도
  int clean;   // 깨끗한 정도
} Animal;</code></pre><ul>
<li><p>이부분은 구조체로 서로 다른 타입의 데이터를 하나로 묶으로 지정하는 사용자 정의 자료형임</p>
</li>
<li><p>void one_day_pass, play etc, 이것들은 함수로 지정하여 switch 로 지정했을때 그것을 할당하는것을 의미하는것임</p>
</li>
<li><p>키 포인트는 동물을 포인터로 만들어 그것을 선택하면 동물값을 입력하는 구조로 만듬</p>
</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[2. C++ 참조자(레퍼런스)의 도입]]></title>
            <link>https://velog.io/@happy_lee0_0/2.-C-%EC%B0%B8%EC%A1%B0%EC%9E%90%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4%EC%9D%98-%EB%8F%84%EC%9E%85</link>
            <guid>https://velog.io/@happy_lee0_0/2.-C-%EC%B0%B8%EC%A1%B0%EC%9E%90%EB%A0%88%ED%8D%BC%EB%9F%B0%EC%8A%A4%EC%9D%98-%EB%8F%84%EC%9E%85</guid>
            <pubDate>Wed, 18 Mar 2026 00:48:06 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>해당 내용은 씹어먹는 C++ 책을 기반으로 하단 블로그의 내용을 공부하기위해 적성한 글임을 알립니다.</p>
</blockquote>
<h3 id="레퍼런스의-개념">레퍼런스의 개념</h3>
<p>int x = 10;
int&amp; r = x;</p>
<ul>
<li><p>r과 x는 완전히 동일한 객체</p>
</li>
<li><p>r을 바꾸면 x가 바뀜</p>
</li>
<li><p>선언과 동시에 반드시 초기화 필요</p>
</li>
<li><p>한 번 바인딩되면 다른 변수로 변경 불가</p>
</li>
<li><p>포인터: 주소를 저장 (int* p)</p>
</li>
<li><p>래퍼런스: 변수의 별명 (int&amp; r)</p>
</li>
</ul>
<blockquote>
<p>래퍼런스 = “복사가 아닌 원본 자체를 직접 다루는 별명”</p>
</blockquote>
<pre><code>#include &lt;iostream&gt;

int change_val(int *p) {
  *p = 3;

  return 0;
}
int main() {
  int number = 5;

  std::cout &lt;&lt; number &lt;&lt; std::endl;
  change_val(&amp;number);
  std::cout &lt;&lt; number &lt;&lt; std::endl;
}</code></pre><p>change_val 함수의 인자 p 에 number 의 주소값을 전달하여, *p 를 통해 number 를 참조하여 number 의 값을 3 으로 바꿈</p>
<blockquote>
<p>int&amp; another_a = a;</p>
</blockquote>
<p>그 후에 우리는 a 의 참조자 another_a 를 정의하였습니다. 이 때 참조자를 정하는 방법은, 가리키고자 하는 타입 뒤에 &amp; 를 붙이면 됨</p>
<pre><code>int a = 10;
int* p = &amp;a; // p 는 a 를 가리킨다.

int b = 3;
p = &amp;b // 이제 p 는 a 를 버리고 b 를 가리킨다</code></pre><ul>
<li>p는 a를 가리키는것 즉 a가 현재 주소값을 보여 그것을 가리킴</li>
<li>b는 3의 주소값을 가리킴</li>
</ul>
<pre><code>#include &lt;iostream&gt;

int main() {
  int &amp;ref = 4;

  std::cout &lt;&lt; ref &lt;&lt; std::endl;
}</code></pre><ul>
<li>오류가나옴</li>
<li>위 상수 값 자체는 리터럴 이기 때문에</li>
<li>프로그래밍 언어에서 리터럴(literal)이란, 소스 코드 상에서 고정된 값을 가지는 것을 일컫습니다</li>
</ul>
<pre><code>int a, b;
int&amp; arr[2] = {a, b};</code></pre><ul>
<li>주소값이 존재한다라는 의미는 해당 원소가 메모리 상에서 존재한다 라는 의미와 같습니다. 하지만 레퍼런스는 특별한 경우가 아닌 이상 메모리 상에서 공간을 차지 하지 않습니다. 따라서 이러한 모순 때문에 레퍼런스들의 배열을 정의하는 것은 언어 차원에서 금지가 됨</li>
</ul>
<pre><code>int&amp; function() {
  int a = 2;
  return a;
}

int main() {
  int b = function();
  b = 3;
  return 0;
}</code></pre><p>-&gt; [1]    7170 segmentation fault (core dumped)  ./test 이런 오류가 나옴</p>
<pre><code>int&amp; ref = a;

// 근데 a 가 사라짐
int b = ref;  // !!!</code></pre><ul>
<li>레퍼런스가 필요한데 사라지게됨 이래서 문제임</li>
<li>따라서 위 처럼 레퍼런스를 리턴하는 함수에서 지역 변수의 레퍼런스를 리턴하지 않도록 조심해야함</li>
</ul>
<pre><code>int&amp; function(int&amp; a) {
  a = 5;
  return a;
}

int main() {
  int b = 2;
  int c = function(b);
  return 0;
}</code></pre><ul>
<li>이경우는 래퍼런스 값이 b로 연결이 되어 그대로 레퍼런스와 연결이 됨 그래서 오류가 안나옴<pre><code>#include &lt;iostream&gt;
</code></pre></li>
</ul>
<p>int function() {
  int a = 5;
  return a;
}</p>
<p>int main() {
  const int&amp; c = function();
  std::cout &lt;&lt; &quot;c : &quot; &lt;&lt; c &lt;&lt; std::endl;
  return 0;
}</p>
<pre><code>이런 경우 const로 예외 상수로 받아 상수 레퍼런스로 리턴값을 받게 되면 해당 리턴값의 생명이 연장됨

| 함수 반환              | 받는 방식                | 가능 여부  | 동작 설명                         | 주의사항            |
| ------------------ | -------------------- | ------ | ----------------------------- | --------------- |
| `int f()` (값 반환)   | `int a = f()`        | 가능     | 값 복사됨                         | 없음              |
| `int f()` (값 반환)   | `int&amp; a = f()`       | 컴파일 오류 | rvalue를 non-const 참조로 받을 수 없음 | -               |
| `int f()` (값 반환)   | `const int&amp; a = f()` | 가능     | 임시 객체를 const 참조로 바인딩          | lifetime 연장     |
| `int&amp; f()` (참조 반환) | `int a = f()`        | 가능     | 값 복사됨                         | 참조 의미 사라짐       |
| `int&amp; f()` (참조 반환) | `int&amp; a = f()`       | 가능     | 원본 변수 참조                      | **지역 변수 반환 금지** |
| `int&amp; f()` (참조 반환) | `const int&amp; a = f()` | 가능     | const 참조로 바인딩                 | **지역 변수 반환 금지** |




---
### 참고
https://modoocode.com/141</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[1-2 / 1-3 첫 C++ 프로그램 분석 및 공통점]]></title>
            <link>https://velog.io/@happy_lee0_0/1-2-1-3-%EC%B2%AB-C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8-%EB%B6%84%EC%84%9D-%EB%B0%8F-%EA%B3%B5%ED%86%B5%EC%A0%90</link>
            <guid>https://velog.io/@happy_lee0_0/1-2-1-3-%EC%B2%AB-C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8-%EB%B6%84%EC%84%9D-%EB%B0%8F-%EA%B3%B5%ED%86%B5%EC%A0%90</guid>
            <pubDate>Sun, 15 Mar 2026 15:45:28 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>해당 내용은 씹어먹는 C++ 책을 기반으로 하단 블로그의 내용을 공부하기위해 적성한 글임을 알립니다.</p>
</blockquote>
<h2 id="씹어먹는-c---1---2-첫-c-프로그램-분석하기">씹어먹는 C++ - &lt;1 - 2. 첫 C++ 프로그램 분석하기&gt;</h2>
<pre><code>#include &lt;iostream&gt;

int main() {
  std::cout &lt;&lt; &quot;Hello, World!!&quot; &lt;&lt; std::endl;
  return 0;
}</code></pre><blockquote>
<p>#include <iostream></p>
</blockquote>
<ul>
<li>해당 부분은 C++ 에서 표준 입출력에 대한 필요한것을 포함함</li>
</ul>
<blockquote>
<p>int main()</p>
</blockquote>
<ul>
<li>C 와 마찬가지로 C++ 에서의 main 함수는 프로그램이 실행될 때 가장 먼저 실행되는 함수</li>
</ul>
<blockquote>
<p>std::cout &lt;&lt; &quot;Hello, World!!&quot; &lt;&lt; std::endl;
return 0;  </p>
</blockquote>
<ul>
<li><p>std::cout 은 화면에 무언가 출력시켜주는 것 같은데, printf 와 다르게 사용된 것을 보니 함수 같지는 않네요. 그리고 화면에 출력된 것을 대충 보면 &quot;계속하려면 아무 키나 누르세요&quot; 가 한 줄 개행되어서 나온 것을 보니 std::endl 은 한 줄 엔터를 쳐서 나타내라는 표시 </p>
<ul>
<li>main 함수에서도 return</li>
</ul>
</li>
</ul>
<blockquote>
<p>std::cout</p>
</blockquote>
<ul>
<li>std 는 C++ 표준 라이브러리의 모든 함수, 객체 등이 정의된 이름 공간(namespace) </li>
<li>std 라는 이름 공간에 정의되어 있는 cout 을 의미 합니다. 만약에 std:: 없이 그냥 cout 이라고 한다면 컴파일러가 cout 을 찾지 못합니다. 서울에 사는 철수인지 부산에 사는 철수 인지 알 길이 없기 때문</li>
</ul>
<pre><code>#include &quot;header1.h&quot;
#include &quot;header2.h&quot;

namespace header1 {
int func() {
  foo();           // 알아서 header1::foo() 가 실행된다.
  header2::foo();  // header2::foo() 가 실행된다.
}
}  // namespace header1</code></pre><ul>
<li>소속을 밝히면 이게 이거를 불러오게 됨<pre><code>#include &quot;header1.h&quot;
#include &quot;header2.h&quot;
using namespace header1;
</code></pre></li>
</ul>
<p>int main() {
  header2::foo();  // header2 에 있는 함수를 호출
  foo();           // header1 에 있는 함수를 호출
}</p>
<pre><code>어쩃든 호출하는것임

---

  다시 돌아가서
</code></pre><p>int main() {
  std::cout &lt;&lt; &quot;Hello, World!!&quot; &lt;&lt; std::endl;
  return 0;
}</p>
<pre><code>두 iostream 헤더파일의 std 라는 이름 공간에 정의되어 있는 것을 불러옴
</code></pre><p>#include <iostream>
using namespace std;</p>
<p>int main() {
  cout &lt;&lt; &quot;Hello, World!!&quot; &lt;&lt; endl;
  return 0;
}</p>
<pre><code>
귀찮은면 이렇게 함

---
## 씹어먹는 C++ - &lt;1 - 3. C++ 은 C 친구 - C 와 공통점&gt;
</code></pre><p>// 변수의 정의
#include <iostream></p>
<p>int main() {
  int i;
  char c;
  double d;
  float f;</p>
<p>  return 0;
}</p>
<pre><code>변수 정의
</code></pre><p>int arr[10];
int *parr = arr;</p>
<p>int i;
int *pi = &i;</p>
<pre><code>- 포인터로 arr[10]이라는 배열이 있음
- int *parr = arr; parr 포인터로 받는 변수를 정해 arr 값의 &amp;arr[0] 주소 값을 저장
 - parr = 1000(&amp;arr[0]의 주소값)
  - *parr = arr[0] 즉 1000이 가리키는 값이 되어 arr[0] 이됨

  - i라는값이 있음
  - i의 주소값을 출력해서 pi포인터에 저장
</code></pre><p>// C++ 의 for 문
#include <iostream></p>
<p>int main() {
  int i;</p>
<p>  for (i = 0; i &lt; 10; i++) {
    std::cout &lt;&lt; i &lt;&lt; std::endl;
  }
  return 0;
}</p>
<pre><code>반복문(for, while)
</code></pre><p>// switch 문 이용하기
#include <iostream></p>
<p>using std::cout;
using std::endl;
using std::cin;</p>
<p>int main() {
  int user_input;
  cout &lt;&lt; &quot;저의 정보를 표시해줍니다&quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;1. 이름 &quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;2. 나이 &quot; &lt;&lt; endl;
  cout &lt;&lt; &quot;3. 성별 &quot; &lt;&lt; endl;
  cin &gt;&gt; user_input;</p>
<p>  switch (user_input) {
    case 1:
      cout &lt;&lt; &quot;Psi ! &quot; &lt;&lt; endl;
      break;</p>
<pre><code>case 2:
  cout &lt;&lt; &quot;99 살&quot; &lt;&lt; endl;
  break;

case 3:
  cout &lt;&lt; &quot;남자&quot; &lt;&lt; endl;
  break;

default:
  cout &lt;&lt; &quot;궁금한게 없군요~&quot; &lt;&lt; endl;
  break;</code></pre><p>  }
  return 0;
}</p>
<p>```
switch 문</p>
<hr>
<p>출처
<a href="https://modoocode.com/136">https://modoocode.com/136</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[1182_부분수열의 합]]></title>
            <link>https://velog.io/@happy_lee0_0/1182%EB%B6%80%EB%B6%84%EC%88%98%EC%97%B4%EC%9D%98-%ED%95%A9</link>
            <guid>https://velog.io/@happy_lee0_0/1182%EB%B6%80%EB%B6%84%EC%88%98%EC%97%B4%EC%9D%98-%ED%95%A9</guid>
            <pubDate>Thu, 12 Feb 2026 02:01:45 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/2d17a7f6-18d4-4b86-9e52-f12420d1574e/image.png" alt=""></p>
<p>예제 입력 1 
5 0
-7 -3 -2 5 8</p>
<p>예제 출력 1 
1</p>
<h2 id="study-part">study part</h2>
<ul>
<li>항상 보는 백트래킹으로 문제를 풀이함</li>
</ul>
<pre><code>    if(arrange_count==input_count)
    {
        return 0;
    }

    if(sum_value+arrange_value[arrange_count]==input_sum)
    {
        output_count+=1;
    }</code></pre><ul>
<li><p>이부분에서는 먼저 기입한 값과 동일하면 끝 그리고 input_sum이 같으면 output_count+1 형식으로 결과를 도출하고 자함</p>
<pre><code>  check_num(sum_value,arrange_count+1);

  check_num(sum_value+arrange_value[arrange_count],arrange_count+1);

  return 0;</code></pre></li>
<li><p>이부분에서는 진행정도와 값이 계속 누적되는것을 추가하는것으로 합해지는것 이렇게 해서 check_num을 만드는것</p>
</li>
</ul>
<h2 id="code">code</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;vector&gt;
using namespace std;

int input_count;

int input_sum;

int output_count = 0;

vector &lt;int&gt; arrange_value;

int check_num(int sum_value,int arrange_count)
{
    if(arrange_count==input_count)
    {
        return 0;
    }

    if(sum_value+arrange_value[arrange_count]==input_sum)
    {
        output_count+=1;
    }

    check_num(sum_value,arrange_count+1);

    check_num(sum_value+arrange_value[arrange_count],arrange_count+1);

    return 0;
}

int main()
{
    cin&gt;&gt;input_count&gt;&gt;input_sum;
    arrange_value.resize(input_count);

    for(int i = 0 ; i&lt;input_count;i++)
    {
        cin&gt;&gt;arrange_value[i];
    }

    check_num(0,0);

    cout&lt;&lt;output_count;

}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[1. Control system engineering(Introduction)]]></title>
            <link>https://velog.io/@happy_lee0_0/1.-%EC%84%9C%EB%A1%A0</link>
            <guid>https://velog.io/@happy_lee0_0/1.-%EC%84%9C%EB%A1%A0</guid>
            <pubDate>Mon, 09 Feb 2026 09:41:54 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>해당 글은 개인적으로 공부하기 위한 글로 알아주시면 감사하겠습니다.</p>
</blockquote>
<h1 id="1시스템-구조">1.시스템 구조</h1>
<h2 id="개루프-시스템">개루프 시스템</h2>
<ul>
<li>개루프 시스템은 입력 명령을 제어하기에 적합한 형태로 변환하는 <strong>입력변환기(input transducer)</strong>라는 보조 시스템으로 시작함</li>
<li>입력은 <strong>기준입력(reference)</strong>로 칭하며 출력은 <strong>피제어 변수(controlled variable)</strong>라고 칭함</li>
<li>외란과 같은 신호는 입력되는 신호들을 대수적으로 합하는 접합점(summing junction)에서 제어기나 공정의 출력과 합해짐</li>
<li>질량이 움직일때 일정한 힘을 소모하는 <strong>제동기(damper)</strong>와 질량 및 스프링으로 구성되는 기계 시스템은 또 다른 개루프 시스템의 한 예임</li>
<li>개루프는 외란에 민감하여 외란을 제거하지 못하는 것이 단점</li>
</ul>
<h2 id="폐루프-시스템feedback-system">폐루프 시스템(feedback system)</h2>
<ul>
<li>입력 변환기는 입력 명령을 제어기에 적합한 형태로 변환시키며 출력변환기(output transducer) 또는 센서(sensor)로 출력을 측정하여 제어기에 적합한 형태로 변환</li>
<li>접합점으로 피드백 경로(feedback path)을 통하여 도달하는 출력 신호와 입력 신호를 대수적으로 합함</li>
<li>출력 신호의 부호가 반전되어 신호가 합해지는데 이를 구동신호(actuating signal)이라고 함</li>
<li>실제 입력과 출력의 차가 구동 신호가 되는데이를 오차(error) 라고 함</li>
<li>간단한 이득 조정을 하거나 제어기를 재설계함으로 써 과도 응답과 정상 상태 오차를 개선시키는것을 보상(compensating)이라고 함 재설계된 하드웨어를 보상기(compensator)라고 함</li>
</ul>
<h1 id="2-해석과-설계-목적">2. 해석과 설계 목적</h1>
<h2 id="과도-응답">과도 응답</h2>
<ul>
<li>과도 응답이 너무 빠르면 복구하지 못할 물리적 손상을 시스템에 입힐수 있음<h2 id="정상상태-응답">정상상태 응답</h2>
<h2 id="안정도">안정도</h2>
</li>
<li>과도 응답과 정상 상태 오차에 대한 해석과 설계는 시스템이 안정하지 않는 경우에는 의미가 없음</li>
<li>고유응답(natural response)과 강제응답(foreced responser)의 합으로 표시됨</li>
<li>이런 응답을 각각 동차해(homogeneous solution), 특이해(particular solution)이라함</li>
<li>선형시스템은 전체 응답의 다음과 같이 표현됨
$$
전체 응답 = 고유  응답 + 강제응답
$$<h2 id="사례연구">사례연구</h2>
</li>
<li>이런 진동하거나 정상 상태에서는 고유응답이 0으로 되어 강제응답만 남는 경우 불안정(instability)라고 함</li>
<li>감쇠진동(daped oscillation) : 시간에 따라 크기가 줄어드는 정현파 응답하는 과도 상태를 갖게 되는것<h1 id="3-설계-절차">3. 설계 절차</h1>
<h2 id="1단계--요구조건에-맞는-실제-시스템-선정">1단계 : 요구조건에 맞는 실제 시스템 선정</h2>
</li>
<li>요구 조건에 맞는 실제 시스템(physical system)을 선정함<h2 id="2단계--기능별-블럭선도-작성">2단계 : 기능별 블럭선도 작성</h2>
</li>
<li>정상적으로 표현된 시스템의 각 부분을 기능별 블록선도로 나타내고 이를 블록들을 상호 연결하여 전체 블록선도를 완성함<h2 id="3단계--구조-개요도-도안">3단계 : 구조 개요도 도안</h2>
</li>
<li>예로 직류전동기(dc motor) 구동 시키기 위해 차동 증폭기(differential amplifier)와 전력 증폭기는 각각 이득이나 전력 증폭을 하는 제어기로 사용됨</li>
<li>부하(load)의 경우 회전하는 질량과 베어링 마찰을 가지므로 부하 모델은 자동차의 충격 흡수 장치나 스크린 문 제동기(screen door damper)와 같이 속도와 증가함에 따라 역회전 토크(torque)가 증가되는 관성(inertia)와 점성마찰(viscous damping)으로 표현됨</li>
</ul>
<h2 id="4단계--수학적-모델의-개발">4단계 : 수학적 모델의 개발</h2>
<ul>
<li>시스템 구조에 대한 개요도가 완성되면 전기 회로에 kirchhoff의 법칙과 실제 시스템에 대해 적용되는 Newton의 법칙과 같은 물리적 법칙과 가정을 이용하여 시스템을 모델링함</li>
<li>kirchhoff의 전압 / 전류 법칙, newton의 법칙을 이용하면서 동적 시스템의 입력과 출력 사이의 관계를 나타내는 수학적 모델링을 얻을수 있음</li>
<li>선형 시불변 미분방정식(linear time-invariant differential equation)으로 표시됨</li>
<li>시스템 모델은 차수가 높아지거나 비선형 시변(nonlinear time varying) 또는 편미분 방정식(partial differential equation)으로 표현됨</li>
<li>전달함수(transfer function)은 시스템을 수학적으로 모델링하는 방법으로 전달함수를 laplace변환을 이용하여 선형 시불변 미분방정식으로 유도됨</li>
<li>상태공간(state space)에서도 시스템 모델이 표현될수 있음 이는 모델을 상태 공간에서 표현하려는 이유는 선형 미분 방정식으로 나타낼수 없는 시스템에서도 적용할수 있을 뿐만 아니라 시뮬레이션하기 편한 형태로 나타낼수 있기 때문<h2 id="5단계--블럭선도-단순화">5단계 : 블럭선도 단순화</h2>
<h2 id="6단계--해석과-설계">6단계 : 해석과 설계</h2>
<img src="https://velog.velcdn.com/images/happy_lee0_0/post/9e2c85bc-5573-4819-b00f-89966200956d/image.png" alt=""></li>
<li>계단 함수 : 위치 속도나 가속도가 일정한 크기를 가질때 입력 명령을 표시하는데 사용됨</li>
<li>램프 함수 입력 : 선형으로 증가하는 명령을 나타냄</li>
<li>정현파 입력 : 시스템에 대한 수학적 모델을 유도하기 위하여 실제 시스템을 시험하는데 이용됨</li>
</ul>
<p>감도(sensitivity) : 시스템 파라미터 변동에 대한 성능 변동을 퍼센트로</p>
<hr>
<p>english version</p>
<h1 id="1-system-architecture">1. System Architecture</h1>
<h2 id="11-open-loop-systems">1.1 Open-Loop Systems</h2>
<p>An <strong>open-loop control system</strong> operates without feedback.</p>
<ul>
<li>The system begins with an <strong>input transducer</strong>, which converts the command into a form suitable for the controller/plant.</li>
<li>The input signal is called the <strong>reference input</strong>.</li>
<li>The output is referred to as the <strong>controlled variable</strong>.</li>
<li>Disturbances may enter at a <strong>summing junction</strong>, where signals are algebraically combined.</li>
</ul>
<p><strong>Example:</strong> A mechanical system composed of a mass, spring, and damper.</p>
<ul>
<li>A <strong>damper</strong> dissipates energy (typically proportional to velocity).</li>
</ul>
<p><strong>Limitation:</strong><br>Open-loop systems are sensitive to disturbances and cannot automatically correct for unexpected variations, leading to degraded accuracy and robustness.</p>
<hr>
<h2 id="12-closed-loop-systems-feedback-systems">1.2 Closed-Loop Systems (Feedback Systems)</h2>
<p>A <strong>closed-loop system</strong> uses feedback to reduce error and improve robustness.</p>
<ul>
<li>The <strong>input transducer</strong> converts the reference command for the controller.</li>
<li>A <strong>sensor (output transducer)</strong> measures the output and converts it into a comparable signal form.</li>
<li>The measured output returns through the <strong>feedback path</strong> to the summing junction.</li>
</ul>
<p>The <strong>error (actuating signal)</strong> is:</p>
<p>$$
e(t) = r(t) - y(t)
$$</p>
<p>where:</p>
<ul>
<li>$r(t)$: reference input  </li>
<li>$y(t)$: output  </li>
<li>$e(t)$: error (actuating signal)</li>
</ul>
<h3 id="compensation">Compensation</h3>
<p>Improving transient response or steady-state error by gain adjustment or controller redesign is called <strong>compensation</strong>.  
The redesigned element is called a <strong>compensator</strong>.</p>
<hr>
<h1 id="2-objectives-of-analysis-and-design">2. Objectives of Analysis and Design</h1>
<p>Control design typically focuses on:</p>
<ul>
<li>Transient response  </li>
<li>Steady-state response  </li>
<li>Stability  </li>
</ul>
<hr>
<h2 id="21-transient-response">2.1 Transient Response</h2>
<p>Transient response describes system behavior before reaching steady state.</p>
<p>Key measures include:</p>
<ul>
<li>rise time  </li>
<li>peak time  </li>
<li>overshoot  </li>
<li>settling time  </li>
</ul>
<p><strong>Engineering note:</strong> An excessively fast transient can cause actuator saturation or physical damage in real systems.</p>
<hr>
<h2 id="22-steady-state-response">2.2 Steady-State Response</h2>
<p>Steady-state response describes long-term behavior after transients decay.</p>
<p>A key metric is the <strong>steady-state error</strong>, which depends on:</p>
<ul>
<li>system type  </li>
<li>input class (step, ramp, etc.)</li>
</ul>
<hr>
<h2 id="23-stability">2.3 Stability</h2>
<p>If the system is unstable, transient and steady-state specifications are meaningless.</p>
<p>For an LTI system:</p>
<p>$$
\text{Total Response} = \text{Natural Response} + \text{Forced Response}
$$</p>
<ul>
<li>Natural response = <strong>homogeneous solution</strong></li>
<li>Forced response = <strong>particular solution</strong></li>
</ul>
<p>For a stable system:</p>
<p>$$
\lim_{t \to \infty} \text{Natural Response} = 0
$$</p>
<h3 id="damped-oscillation">Damped Oscillation</h3>
<p>A <strong>damped oscillation</strong> is a transient sinusoidal response whose amplitude decreases over time due to dissipation.</p>
<hr>
<h1 id="3-design-procedure">3. Design Procedure</h1>
<h2 id="step-1-select-the-physical-system">Step 1: Select the Physical System</h2>
<p>Select a physical system that satisfies the given performance requirements, constraints, and operating conditions.</p>
<hr>
<h2 id="step-2-build-the-functional-block-diagram">Step 2: Build the Functional Block Diagram</h2>
<p>Represent each subsystem as a functional block and interconnect them to describe overall signal flow.</p>
<hr>
<h2 id="step-3-draw-the-structural-schematic">Step 3: Draw the Structural Schematic</h2>
<p>Example: DC motor drive system</p>
<ul>
<li>differential amplifier: gain control  </li>
<li>power amplifier: power amplification  </li>
<li>load: inertia + viscous damping  </li>
</ul>
<p>A common load model:</p>
<p>$$
T = J\dot{\omega} + B\omega
$$</p>
<p>where:</p>
<ul>
<li>$J$: inertia</li>
<li>$B$: viscous damping</li>
<li>$\omega$: angular velocity</li>
</ul>
<hr>
<h2 id="step-4-develop-the-mathematical-model">Step 4: Develop the Mathematical Model</h2>
<p>Use physical laws:</p>
<ul>
<li>Kirchhoff’s Voltage/Current Laws (electrical)</li>
<li>Newton’s Second Law (mechanical)</li>
</ul>
<p>Typical result: an <strong>LTI differential equation</strong> relating input and output.</p>
<h3 id="transfer-function">Transfer Function</h3>
<p>Applying Laplace transform:</p>
<p>$$
G(s) = \frac{Y(s)}{R(s)}
$$</p>
<h3 id="state-space-model">State-Space Model</h3>
<p>State equation:</p>
<p>$$
\dot{x} = Ax + Bu
$$</p>
<p>Output equation:</p>
<p>$$
y = Cx + Du
$$</p>
<p><strong>Why state-space?</strong></p>
<ul>
<li>supports MIMO</li>
<li>handles nonlinear extensions</li>
<li>convenient for simulation</li>
<li>foundation of modern control</li>
</ul>
<hr>
<h2 id="step-5-block-diagram-reduction">Step 5: Block Diagram Reduction</h2>
<p>Simplify interconnected blocks using algebraic reduction rules to obtain the overall system form.</p>
<hr>
<h2 id="step-6-analysis-and-controller-design">Step 6: Analysis and Controller Design</h2>
<p>Design the controller to satisfy:</p>
<ul>
<li>stability</li>
<li>transient performance</li>
<li>steady-state accuracy</li>
<li>robustness</li>
</ul>
<hr>
<h1 id="4-standard-test-inputs">4. Standard Test Inputs</h1>
<ul>
<li><strong>Step input:</strong> represents a sudden command (often used in position control evaluation)</li>
<li><strong>Ramp input:</strong> represents a linearly increasing command (useful for tracking analysis)</li>
<li><strong>Sinusoidal input:</strong> used for frequency-response testing and system identification</li>
</ul>
<hr>
<h1 id="5-sensitivity">5. Sensitivity</h1>
<p>Sensitivity measures performance variation due to parameter changes:</p>
<p>$$
S = \frac{% \text{ change in output}}{% \text{ change in parameter}}
$$</p>
<p>Low sensitivity implies strong robustness to modeling uncertainty and component tolerances.</p>
<hr>
<h1 id="6-core-design-balance">6. Core Design Balance</h1>
<p>Control design fundamentally balances:</p>
<ol>
<li>Stability  </li>
<li>Performance  </li>
<li>Robustness  </li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[모터 확인용]]></title>
            <link>https://velog.io/@happy_lee0_0/%EB%AA%A8%ED%84%B0-%ED%99%95%EC%9D%B8%EC%9A%A9</link>
            <guid>https://velog.io/@happy_lee0_0/%EB%AA%A8%ED%84%B0-%ED%99%95%EC%9D%B8%EC%9A%A9</guid>
            <pubDate>Wed, 04 Feb 2026 03:09:05 GMT</pubDate>
            <description><![CDATA[<p>그냥 끄적이고 싶어서 적는용</p>
<p>감속비 : 감속기어를통해 모터의엔진의 입력 회전 속도를 얼마나 줄여서 출력하는지를 나타내는 비율 즉 이거를 하면 기본 모터 단독 스펙에 rpm 자체가 1/14로 줄어들게 됨</p>
<p>허용 부화 : kg/cm 인데 이게 작동하고 나서 유지하는 힘을 기입</p>
<p>순시허용 토크 : 처음 시작할때 확 올라가는 토크임
<img src="https://velog.velcdn.com/images/happy_lee0_0/post/43b6eecd-db13-476a-8dd8-2ed5eabf34fc/image.png" alt="">
이것도 최대 토크는 처음 시작하는 힘 그리고 최대 출력으로는 그냥 유지 될수 있는힘</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[6603_로또]]></title>
            <link>https://velog.io/@happy_lee0_0/6603%EB%A1%9C%EB%98%90</link>
            <guid>https://velog.io/@happy_lee0_0/6603%EB%A1%9C%EB%98%90</guid>
            <pubDate>Fri, 09 Jan 2026 02:12:05 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/bbc7d3cf-4845-4549-9e1b-eab8d0484283/image.png" alt="">
예제 입력 1 
7 1 2 3 4 5 6 7
8 1 2 3 5 8 13 21 34
0
예제 출력 1 
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 6 7
1 2 3 5 6 7
1 2 4 5 6 7
1 3 4 5 6 7
2 3 4 5 6 7</p>
<p>1 2 3 5 8 13
1 2 3 5 8 21
1 2 3 5 8 34
1 2 3 5 13 21
1 2 3 5 13 34
1 2 3 5 21 34
1 2 3 8 13 21
1 2 3 8 13 34
1 2 3 8 21 34
1 2 3 13 21 34
1 2 5 8 13 21
1 2 5 8 13 34
1 2 5 8 21 34
1 2 5 13 21 34
1 2 8 13 21 34
1 3 5 8 13 21
1 3 5 8 13 34
1 3 5 8 21 34
1 3 5 13 21 34
1 3 8 13 21 34
1 5 8 13 21 34
2 3 5 8 13 21
2 3 5 8 13 34
2 3 5 8 21 34
2 3 5 13 21 34
2 3 8 13 21 34
2 5 8 13 21 34
3 5 8 13 21 34</p>
<h2 id="study-code">Study code</h2>
<ul>
<li>해당 문제를 풀면서 이제 이해헀다고 생각했는데 아직 이해를 못했다</li>
<li>결과적으로 또 반복하지만 내 위치를 파악하고 그 위치에 도착하면 결과를 출력해라 이것이 메인임</li>
<li>또 해당 결과가 함축했다가 나오는게 아니라 할때마다 계속나와도 되는 것을 파악하고 0 에 결과가 아니라 그냥 할때 마다 결과를 도출함</li>
<li>그리고 여기서 굳이 2차원을 만들필요도 없었고 그냥 1차원으로 해서 만들어도 되었음</li>
<li>그래서 필요없는 clear를 쓰고 이런거임</li>
<li>결론적으로 도착하면 결과 그리고 layer 자체가 내가 input 한거 보다 이상 넘어갈수 있어서 그게 아니면 return임</li>
<li>추가적으로 void 라서 return 0  이 아니라 return임</li>
<li>백트래킹으로 계혹 들어가는 것과 재귀를 활용함</li>
<li>그래서 값을 계속 저장하고 for은 현재 layer로 이동한것이니 시작은 layer로 잡음</li>
<li>그리고 재귀는 result_function에 i를 넣으면서 해당 루프에 전체를 다 수색하게 함</li>
</ul>
<p>추가적인것 2차원 resize하는거 ㄱemind</p>
<pre><code>int n
cin &gt;&gt;n;

vector &lt;vector&lt;int&gt;&gt; new;

new.reszie(n);

for(int = 0 ; i &lt; n;i++)
{
    new[i].resize(n);
}</code></pre><p>or</p>
<pre><code>vector &lt;vector&lt;int&gt;&gt; new(n, vector&lt;int&gt;(n));</code></pre><h2 id="code">Code</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

using namespace std;

vector&lt;vector&lt;int&gt;&gt; input_list;

int input_value;

int value_result[6];

void result_function(int layer,int count)
{
    if(count==6)
    {
        for(int i=0 ; i&lt;6 ; i++)
        {
            cout&lt;&lt;value_result[i]&lt;&lt;&quot; &quot;;
        }
        cout&lt;&lt;&quot;\n&quot;;
        return;
    }

    if(layer&gt;=input_value) return;

    for(int i=layer ; i&lt;input_value ; i++)
    {
        value_result[count]=input_list[0][i];
        result_function(i+1,count+1);
    }
}

int main()
{
    while(1)
    {
        cin&gt;&gt;input_value;

        if(input_value == 0)
        {
            return 0;
        }

        vector &lt;int&gt; row_value(input_value);

        for(int i = 0; i&lt;input_value ; i++)
        {
            cin&gt;&gt;row_value[i];
        }

        input_list.clear();
        input_list.push_back(row_value);
        result_function(0,0);
        cout&lt;&lt;&quot;\n&quot;;
    }


}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[10971_왼판원 순회2(포인터 배열공부)]]></title>
            <link>https://velog.io/@happy_lee0_0/10971%EC%99%BC%ED%8C%90%EC%9B%90-%EC%88%9C%ED%9A%8C2%ED%8F%AC%EC%9D%B8%ED%84%B0-%EB%B0%B0%EC%97%B4%EA%B3%B5%EB%B6%80</link>
            <guid>https://velog.io/@happy_lee0_0/10971%EC%99%BC%ED%8C%90%EC%9B%90-%EC%88%9C%ED%9A%8C2%ED%8F%AC%EC%9D%B8%ED%84%B0-%EB%B0%B0%EC%97%B4%EA%B3%B5%EB%B6%80</guid>
            <pubDate>Wed, 31 Dec 2025 01:48:45 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/44bee7bb-0f09-489e-b734-c5627bc79feb/image.png" alt="">
예제 입력 1 
4
0 10 15 20
5 0 9 10
6 13 0 12
8 8 9 0</p>
<p>예제 출력 1 
35</p>
<h2 id="study-code">Study code</h2>
<h3 id="part1">Part1</h3>
<ul>
<li>2차원 배열을 만들어야 하는데 vector와 포인터 중에 뭐를 쓸지 고민했음</li>
<li>그래서 오래간만에 포인터를 활용하여 2차원 배열을 만들고자 했음</li>
<li>하지만 gpt나 현업에서는 vector를 사용하는것이 일반적이라고 함</li>
<li>포인터를 쓰게 되면 이렇게 메모리를 만들어줘야함
a
│
├─ a[0] ──▶ int int int int
├─ a[1] ──▶ int int int int
├─ a[2] ──▶ int int int int
└─ a[3] ──▶ int int int int</li>
</ul>
<pre><code>int** a;

    a = new int*[input_num];

    for(int j = 0 ; j &lt; input_num;j++)
    {
        a[j] = new int[input_num];
    }   
</code></pre><p>그래서 이렇게 진행해야 함</p>
<ul>
<li>이렇게 한다음 그냥 2차원 배열 사용하듯이 평법하게 사용하면 됨</li>
<li>다 사용하고 나서 하단같이 메모리를 delete를 해야함</li>
<li>안그러면 메모리 누수 또는 런타임 오류가 나올수 있음</li>
</ul>
<pre><code>    for (int i = 0; i &lt; input_num; i++)
    {
    delete[] a[i];
    }
    delete[] a;</code></pre><ul>
<li>각 행마다의 delete와</li>
<li>모든 행의 delete를 진행하는것</li>
</ul>
<h3 id="part2">Part2</h3>
<ul>
<li>이번 문제를 풀면서 코드를 전체를 이해하기 보다는 흐름을 이해해야하는것으로 초점을 두었음</li>
<li>해당 문제에 대한 개념은 결과적으로 백트래킹으로 계속돌아가고 브루트포스로 숫자를 넣어서 비교하는 것으로 진행되어야 했음</li>
<li>그래서 내가 보았을때는 결론적으로 이렇다.</li>
</ul>
<ol>
<li>해당 계산 함수의 시작은 처음 목표값까지 도달으면 그 결과를 나오게 하는것
1-1. 하지만 결과가 나오게 되는 것까지 특정 부분에서 예외가 있는경우가 있으니 return을 하거나 loop 구분이 있을시 continue로 넘어가는것</li>
</ol>
<ol start="2">
<li>다음것은 결과적으로 모든 것의 코드 그리고 index가 있을것이다. 그것을 빠르게 봐야하는 것, 그리고 방문을 했는지 안했는지 판단하는것이 가장 중요하고 계속해서 반복해야하는 부분은 check() 이부분을 반복해야한다.
2-1. 그래서 일단 그 index가 방문했는지 안했는지 판단하여 loop에 if을 해서 있으면 continue로 해서 넘어가고 아니면 그 다음 스텝을 가는것으로 진행
2-2. 그렇게 다음으로 가는것은 앞서 말한대로 check을 불러오는것을 시작으로 그 값에 추가를 하고 계속 자기자신을 불러옴 그리고 그 밑에는 방문을 했으니 flase로 방문을 끝냄</li>
</ol>
<p>-&gt; 여기서 중요한게  check를 하기전에는 true인지 false인지 check을 하고 false면  true로 만들어주고 끝나면 false로 만들어줌</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;vector&gt;
#include &lt;string&gt;

using namespace std;

int input_num;

bool ch[11] = {false,};

int** a;

int output_result = 1e9;

void check(int start,int index,int cnt,int sum_num)
{
    if (sum_num &gt;= output_result) return; 

    if(cnt==input_num)
    {
    if(a[index][start]==0) return;

    output_result = min(output_result, sum_num + a[index][start]);
    return;
    }

    for(int i = 0;i&lt;input_num;i++)
    {
        if(a[index][i]==0||ch[i]) continue;
        ch[i]=true;
        check(start,i,cnt+1,sum_num+a[index][i]);
        ch[i]=false;
    }
}

int main()
{
    cin&gt;&gt;input_num;
    a = new int*[input_num];

    for(int j = 0 ; j &lt; input_num;j++)
    {
        a[j] = new int[input_num];
    }   

    for(int i = 0 ; i&lt; input_num;i++)
    {
        for(int j = 0 ; j &lt; input_num;j++)
        {
            cin&gt;&gt;a[i][j];
        }   
    }

    for (int i = 0; i &lt; input_num; i++)
    {
        ch[i] = true;
        check(i,i,1,0);
        ch[i] = false;
    }

    cout&lt;&lt;output_result;

    for (int i = 0; i &lt; input_num; i++)
    {
    delete[] a[i];
    }
    delete[] a;

    /*
    메모리 누수 또는 런타임 오류
    */

    return 0;
}


</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[10819_차이를 최대로]]></title>
            <link>https://velog.io/@happy_lee0_0/10819%EC%B0%A8%EC%9D%B4%EB%A5%BC-%EC%B5%9C%EB%8C%80%EB%A1%9C</link>
            <guid>https://velog.io/@happy_lee0_0/10819%EC%B0%A8%EC%9D%B4%EB%A5%BC-%EC%B5%9C%EB%8C%80%EB%A1%9C</guid>
            <pubDate>Mon, 22 Dec 2025 01:47:18 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/b16e2358-ddee-4671-8b4b-818110aff296/image.png" alt=""></p>
<p>예제 입력 1 
6
20 1 15 8 4 10</p>
<p>예제 출력 1 
62</p>
<h2 id="code-study">code study</h2>
<ul>
<li>저기 절대값이 있다는것을 순간적으로 몰라서 멍때리다가 절대값이라길래 아하 하고 풀었음</li>
<li>next_permutation을 활용하였고 저번과 같이 배열을 sort를 하여 순서대로 하고 수식을 넣어 하나하나 비교하면서 풀었음</li>
<li>sort(input_value.begin(),input_value.end()); 이방향으로 진행함</li>
<li>절댓값ㄷ이 abs라는것을 한번더 상기</li>
<li><pre><code>  for(int i = 0; i&lt;input_count-1;i++)
  {
     check_result+=abs(input_value[i]-input_value[i+1]);
  }</code></pre>이부분에서 어디까지라는것을 먼저 확인하고 들어감</li>
</ul>
<h2 id="code">code</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
using namespace std;

int input_count;

vector &lt;int&gt; input_value;

int output_result = 0;

int check_result;


void check_num()
{
    do
    {
    for(int i = 0; i&lt;input_count-1;i++)
    {
       check_result+=abs(input_value[i]-input_value[i+1]);
    }
    if(output_result &lt; check_result)
    {
        output_result=check_result;
    }
    check_result=0;
    }while(next_permutation(input_value.begin(),input_value.end()));

    cout&lt;&lt;output_result;
}

int main()
{
    cin&gt;&gt;input_count;

    input_value.resize(input_count);

    for(int i = 0; i&lt;input_count;i++)
    {
        cin&gt;&gt;input_value[i];
    }    

    sort(input_value.begin(),input_value.end());

    check_num();
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[10972_다음 순열]]></title>
            <link>https://velog.io/@happy_lee0_0/10972%EB%8B%A4%EC%9D%8C-%EC%88%9C%EC%97%B4</link>
            <guid>https://velog.io/@happy_lee0_0/10972%EB%8B%A4%EC%9D%8C-%EC%88%9C%EC%97%B4</guid>
            <pubDate>Fri, 19 Dec 2025 01:37:21 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/ba19c760-53fe-4999-a4ef-205e15f8d879/image.png" alt=""></p>
<p>예제 입력 1 
4
1 2 3 4
예제 출력 1 
1 2 4 3</p>
<p>예제 입력 2 
5
5 4 3 2 1
예제 출력 2 
-1</p>
<h2 id="공부내용">공부내용</h2>
<ul>
<li>next_permutation를 배웠는데 이는 순열의 다음것을 출력해주는것임</li>
<li>이는 algorithm을 활용하면 #include가 있어야함</li>
<li>prev_permutation를 활용하면 전꺼가 되니까 기억해라<pre><code>  if(next_permutation(get_num.begin(),get_num.end()))
  {
      for(int i = 0;i&lt;in_num;i++)
      {
          cout&lt;&lt;get_num[i]&lt;&lt;&#39; &#39;;
      }
  }</code></pre>이렇게 하면 다음께 출력이 되고</li>
</ul>
<pre><code>    do{ 
    for(int i = 0;i&lt;in_num;i++) 
    {
        cout&lt;&lt;get_num[i]&lt;&lt;&#39; &#39;;
    }
    }while(next_permutation(get_num.begin(),get_num.end()));```</code></pre><p>이렇게 하면 모든 순열이 출력이 된다</p>
<h2 id="code">code</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;vector&gt;

using namespace std;

int in_num;

vector &lt;int&gt; get_num; 


int main()
{
    cin&gt;&gt;in_num;

    get_num.resize(in_num);

    for(int i = 0;i&lt;in_num;i++)
    {
        cin&gt;&gt;get_num[i];
    }


    if(next_permutation(get_num.begin(),get_num.end()))
    {
        for(int i = 0;i&lt;in_num;i++)
        {
            cout&lt;&lt;get_num[i]&lt;&lt;&#39; &#39;;
        }
    }
    else
    {
        cout&lt;&lt;-1;
    }

    return 0;
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[1248_guess(어렵구만)]]></title>
            <link>https://velog.io/@happy_lee0_0/1248guess%EC%96%B4%EB%A0%B5%EA%B5%AC%EB%A7%8C</link>
            <guid>https://velog.io/@happy_lee0_0/1248guess%EC%96%B4%EB%A0%B5%EA%B5%AC%EB%A7%8C</guid>
            <pubDate>Thu, 18 Dec 2025 01:26:27 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/fff04b78-41da-4e27-ae6a-889d4d6c95f6/image.png" alt=""></p>
<p>예제 입력 1 
4
-+0++++--+
예제 출력 1 
-2 5 -3 1</p>
<p>예제 입력 2 
2
+++
예제 출력 2 
3 4</p>
<p>예제 입력 3 
5
++0+-+-+--+-+--
예제 출력 3 
1 2 -3 4 -5</p>
<h2 id="공부">공부</h2>
<ul>
<li>해당 코드를 공부하면서 시간을 많이 쓴것 같음</li>
<li>허나재귀 파트의 마지막 문제라서 조금더 집중을 한것같음</li>
<li>해당부분에서 중요한것은 이 세가지라고 생각함</li>
</ul>
<ol>
<li>함수시작에 원하는 개수가 내가 input한 개수와 일치할 경우 그 최종결과를 출력하는것</li>
<li>return과 continue를 활용하여 넘어갈 것은 if을 통해 확인하고 바로 넘어가기 그리고 줄 넘버는 바로 주기</li>
<li>return을 수치를 return 하는것이 아닌 bool을 return함으로써 현재 그 수치가 이 안에 들어와도 되는지 확인하기</li>
</ol>
<p>이렇게 되는것 같은데 </p>
<p>즉 브루토포스로 수치를 다때려 박으면서 재귀를 통해 계속 자기자신을 반복하는것임
그리고 앞서 말할것 처럼 이 방법이 맞는지 확인하고 아니면 바로 돌아가는 것으로 다시 돌아가서 확인하는 백트래킹으로 진행하는것임</p>
<h2 id="코드">코드</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

using namespace std;

char input_num_index[10][10];

int count_num;

int result[10];

bool check_num(int count_void)
{
    int sum = 0;
    for(int i = count_void;i&gt;=0;i--)
    {
        sum = sum+result[i];
        if(input_num_index[i][count_void]==&#39;+&#39;&amp;&amp;sum&lt;=0)
        return false;
        if(input_num_index[i][count_void]==&#39;-&#39;&amp;&amp;sum&gt;=0)
        return false;
        if(input_num_index[i][count_void]==&#39;0&#39;&amp;&amp;sum!=0)
        return false;
    }
    return true;
}

void bfs(int count_void)
{
    if(count_void == count_num)
    {
        for(int i = 0 ; i&lt;count_void;i++)
        {
            cout&lt;&lt;result[i]&lt;&lt;&quot; &quot;;
        }
        exit(0);
    }

    for(int i = -10;i&lt;=10;i++)
    {
        if(input_num_index[count_void][count_void]==&#39;+&#39; &amp;&amp; i&lt;=0) continue;
        if(input_num_index[count_void][count_void]==&#39;-&#39;&amp;&amp; i&gt;=0) continue;
        if(input_num_index[count_void][count_void]==&#39;0&#39;&amp;&amp; i!=0) continue;

        result[count_void] = i; 

        if(check_num(count_void)==true)
        {
            bfs(count_void+1);
        }
    }
}

int main()
{
    int input_bo_index = 0;

    string input_bo;

    cin&gt;&gt;count_num;

    cin&gt;&gt;input_bo;

    for(int i = 0;i&lt;count_num;i++)
    {
        for(int j = i; j&lt;count_num;j++)
        {
            input_num_index[i][j]=input_bo[input_bo_index++];
        }
    }

    bfs(0);
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[2529_부등호]]></title>
            <link>https://velog.io/@happy_lee0_0/2529%EB%B6%80%EB%93%B1%ED%98%B8</link>
            <guid>https://velog.io/@happy_lee0_0/2529%EB%B6%80%EB%93%B1%ED%98%B8</guid>
            <pubDate>Thu, 11 Dec 2025 05:16:26 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/d9723d42-14f1-4907-bf4b-197e77e00604/image.png" alt=""></p>
<p>예제 입력 1 
2
&lt; &gt;</p>
<p>예제 출력 1 
897
021</p>
<p>예제 입력 2 
9</p>
<blockquote>
<p>&lt; &lt; &lt; &gt; &gt; &gt; &lt; &lt;</p>
</blockquote>
<p>예제 출력 2 
9567843012
1023765489</p>
<h2 id="공부노트">공부노트</h2>
<ul>
<li><p>bool check(char big_small,int f_num,int sec_num)<br>처음에는 해당 부분에서 bool check 하는 부분이 어떻게 체크를 해야하는지 몰랐음
그래서 보니까 bool로 return을 해야하는것으로 bool로 바꾸고 진짜 이 기호가 이 숫자가 들어가도 된다 안된다를 true false로 한다는 것에서 신선하게 이해개 되었음</p>
</li>
<li><p>results.push_back(num);
처음에 전체 코드가 완성되면 해당 답에 push를 하여 답을 넣어서 출력하는 식이었음</p>
</li>
<li><p>코드의 핵심 알고리즘</p>
<pre><code>  if(visit[i]) continue;

  else if(depth==0)
  {
      visit[i]=true;
      check_num(depth+1,num+to_string(i));
      visit[i]=false;
  }
  else
  {
      int change_int = num[depth-1]-&#39;0&#39;;
      if(check(equality[depth-1],change_int,i))
      {
      visit[i]=true;
      check_num(depth+1,num+to_string(i));
      visit[i]=false;
      }
  }</code></pre><p>이부분에서 </p>
</li>
</ul>
<h2 id="코드">코드</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;

using namespace std;

int input_value;

char equality[10];

bool visit[10];

vector&lt;string&gt; results;

bool check(char big_small,int f_num,int sec_num)
{
    if(big_small==&#39;&lt;&#39;)
    {
        return f_num &lt; sec_num;
    }
        if(big_small==&#39;&gt;&#39;)
    {
        return f_num &gt; sec_num;
    }
    return false;
} 

void check_num(int depth, string num)
{
    if(depth==input_value+1)
    {
        results.push_back(num);
        return;
    }

    for(int i = 0;i&lt;=9;i++)
    {
        if(visit[i]) continue;

        else if(depth==0)
        {
            visit[i]=true;
            check_num(depth+1,num+to_string(i));
            visit[i]=false;
        }
        else
        {
            int change_int = num[depth-1]-&#39;0&#39;;
            if(check(equality[depth-1],change_int,i))
            {
            visit[i]=true;
            check_num(depth+1,num+to_string(i));
            visit[i]=false;
            }
        }
    }
}

int main()
{   
    cin&gt;&gt;input_value;

    for(int i=0 ;i&lt;input_value;i++)
    {
        cin&gt;&gt;equality[i];
    }

    check_num(0,&quot;&quot;);

    sort(results.begin(),results.end());
    cout&lt;&lt;results.back()&lt;&lt;&quot;\n&quot;;

    cout&lt;&lt;results.front()&lt;&lt;&quot;\n&quot;;    

}


</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[14889,15661_스타트와 링크 및 링크와 스타트]]></title>
            <link>https://velog.io/@happy_lee0_0/1488915661%EC%8A%A4%ED%83%80%ED%8A%B8%EC%99%80-%EB%A7%81%ED%81%AC-%EB%B0%8F-%EB%A7%81%ED%81%AC%EC%99%80-%EC%8A%A4%ED%83%80%ED%8A%B8</link>
            <guid>https://velog.io/@happy_lee0_0/1488915661%EC%8A%A4%ED%83%80%ED%8A%B8%EC%99%80-%EB%A7%81%ED%81%AC-%EB%B0%8F-%EB%A7%81%ED%81%AC%EC%99%80-%EC%8A%A4%ED%83%80%ED%8A%B8</guid>
            <pubDate>Fri, 05 Dec 2025 01:52:19 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/eb737c02-2df1-43e8-8e2a-9eb422e5c87b/image.png" alt="">
예제 입력 1 
4
0 1 2 3
4 0 5 6
7 1 0 2
3 4 5 0
예제 출력 1 
0
예제 입력 2 
6
0 1 2 3 4 5
1 0 2 3 4 5
1 2 0 3 4 5
1 2 3 0 4 5
1 2 3 4 0 5
1 2 3 4 5 0
예제 출력 2 
2
예제 입력 3 
8
0 5 4 5 4 5 4 5
4 0 5 1 2 3 4 5
9 8 0 1 2 3 1 2
9 9 9 0 9 9 9 9
1 1 1 1 0 1 1 1
8 7 6 5 4 0 3 2
9 1 9 1 9 1 0 9
6 5 4 3 2 1 9 0
예제 출력 3 
1</p>
<h2 id="공부노트">공부노트</h2>
<ul>
<li>해당 개념에서 백트래킹을 배우면서 우리가 원하는 값이 안나오면 돌아간다라는 개념을 공부하게 되었음</li>
<li>14889의 문제 같은경우 상대팀과 내 팀의 인원이 같은경우를 생각해야 되어서 n/2를 하며 진행함</li>
<li>그렇게 나누어진 부분을 벡터에 init하고 다음 score값에다가 배열을 하나하나 넣는 방식으로 진행함</li>
<li>그리고 team 부분에 continue 즉 방문을 한 것 우리팀인 것일 경우 continue를 진행하여 다음 for로 가게 만들어 진행함</li>
</ul>
<h2 id="14889코드">14889코드</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
using namespace std;

int line;

int layer[20][20];

int lower_value = 500;

bool team[20];

void teamset(int mem, int fight_mem)
{
    vector&lt;int&gt; start;
    vector&lt;int&gt; link;

    int start_score = 0;

    int link_score = 0;

    if (fight_mem == line/2)
    {
        for(int i = 0 ; i &lt; line ; i++)
        {
            if(team[i]==true)
            {
                start.push_back(i);
            }
            else
            {
                link.push_back(i);
            }
        }

        for(int i = 0 ; i&lt;line/2 ; i++)
        {
            for(int j = 0 ; j&lt;line/2 ; j++)
            {
               start_score+=layer[start[i]][start[j]];
               link_score+=layer[link[i]][link[j]];
            }
        }

        lower_value = min(lower_value,(abs(start_score-link_score)));
        return;
    }

    for(int i = mem ; i &lt; line ; i++)
    {
        if(team[i])
        {
        continue;
        }
        else
        {
            team[i]=true;
            teamset(i,fight_mem+1);
            team[i]=false;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin&gt;&gt;line;

    for(int i = 0 ; i&lt;line;i++)
    {
        for(int j = 0 ; j&lt;line;j++)
        {
            cin&gt;&gt;layer[i][j];
        }
    }
    teamset(0,0);
    cout&lt;&lt;lower_value;
}</code></pre><p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/dc3ec6c8-c1fc-493a-856e-953365e3f967/image.png" alt=""></p>
<p>예제 입력 1 
4
0 1 2 3
4 0 5 6
7 1 0 2
3 4 5 0
예제 출력 1 
0
예제 입력 2 
6
0 1 2 3 4 5
1 0 2 3 4 5
1 2 0 3 4 5
1 2 3 0 4 5
1 2 3 4 0 5
1 2 3 4 5 0
예제 출력 2 
2
예제 입력 3 
8
0 5 4 5 4 5 4 5
4 0 5 1 2 3 4 5
9 8 0 1 2 3 1 2
9 9 9 0 9 9 9 9
1 1 1 1 0 1 1 1
8 7 6 5 4 0 3 2
9 1 9 1 9 1 0 9
6 5 4 3 2 1 9 0
예제 출력 3 
1</p>
<h2 id="공부노트-1">공부노트</h2>
<ul>
<li>이번 문제는 전문제와 다르게 팀수가 제한이 없었음</li>
<li>그래서 일단 모든팀을 true로 만든다음(우리팀으로 만든다음) 내부에 한팀이라도 size가 0이면 return을 하여 다음 함수로 가게 만듬</li>
<li>그리고 link와 start팀은 수가 각각 다르다고 판단하여 size도 나누어 score 값을 추출하고자 함</li>
</ul>
<h2 id="15661코드">15661코드</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
using namespace std;

int input_value[20][20];

int input_count;

int output_answer=50;

bool are_you[20];

void teamset(int count)
{
    vector&lt;int&gt; link;
    vector&lt;int&gt; start;

    int link_score = 0;

    int start_score = 0;


    if(count==input_count)
    {
        for(int i=0;i&lt;input_count;i++)
        {
            if(are_you[i]==true)
                link.push_back(i);
            else
                start.push_back(i);
        }

        if(link.size()==0 || start.size()==0)
        {
            return;
        }

        for(int i = 0;i&lt;link.size();i++)
            for(int j = 0;j&lt;link.size();j++)
            {
                link_score+=input_value[link[i]][link[j]];
            }

        for(int i = 0;i&lt;start.size();i++)
            for(int j = 0;j&lt;start.size();j++)
            {
                start_score+=input_value[start[i]][start[j]];
            }
            output_answer = min(output_answer,abs(link_score-start_score));
            return;
    }

    are_you[count]=true;

    teamset(count+1);

    are_you[count]=false;

    teamset(count+1);

}

int main()
{
    cin&gt;&gt;input_count;

    for(int i=0;i&lt;input_count;i++)
    {
        for(int j=0;j&lt;input_count;j++)
        {
            cin&gt;&gt;input_value[i][j];
        }
    }

    teamset(0);

    cout&lt;&lt;output_answer;

}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[14501_퇴사]]></title>
            <link>https://velog.io/@happy_lee0_0/14501%ED%87%B4%EC%82%AC</link>
            <guid>https://velog.io/@happy_lee0_0/14501%ED%87%B4%EC%82%AC</guid>
            <pubDate>Tue, 02 Dec 2025 01:01:47 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/8dcff24c-a028-4914-9bb8-652b0604acc1/image.png" alt=""></p>
<p>예제 입력 1 
7
3 10
5 20
1 10
1 20
2 15
4 40
2 200
예제 출력 1 
45</p>
<p>예제 입력 2 
10
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
예제 출력 2 
55</p>
<p>예제 입력 3 
10
5 10
5 9
5 8
5 7
5 6
5 10
5 9
5 8
5 7
5 6
예제 출력 3 
20</p>
<p>예제 입력 4 
10
5 50
4 40
3 30
2 20
1 10
1 10
2 20
3 30
4 40
5 50
예제 출력 4 
90</p>
<h3 id="공부-노트">공부 노트</h3>
<h4 id="vector로-여러가지-배열-만들기">vector로 여러가지 배열 만들기</h4>
<ul>
<li>c도 파이썬 같이 배열안에 원하는 만큼 만들면 좋을것 같아서 찾아봄<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
using namespace std;
</code></pre></li>
</ul>
<p>int count_num;
int k;  // 한 줄에 입력될 데이터 개수
vector&lt;vector<int>&gt; layer;</p>
<p>int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);</p>
<pre><code>cin &gt;&gt; count_num &gt;&gt; k;  // 예: 7 3 (7줄, 한 줄에 3개씩 입력)

layer.resize(count_num, vector&lt;int&gt;(k));

for(int i = 0; i &lt; count_num; i++) {
    for(int j = 0; j &lt; k; j++) {
        cin &gt;&gt; layer[i][j];
    }
}</code></pre><p>}</p>
<pre><code>
핵심적인부분이</code></pre><pre><code>layer.resize(count_num, vector&lt;int&gt;(k));

for(int i = 0; i &lt; count_num; i++) {
    for(int j = 0; j &lt; k; j++) {
        cin &gt;&gt; layer[i][j];</code></pre><pre><code>
이부분인데 이렇게 받은 값을 </code></pre><p>vector<int>(k)</p>
<pre><code>로 하면 여러개를 받을수 있음


### 코드</code></pre><p>#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;</p>
<p>int count_num;</p>
<p>vector&lt;pair&lt;int, int&gt;&gt; layer;</p>
<p>int* dp;</p>
<p>void soultion_get(const vector&lt;pair&lt;int,int&gt;&gt;&amp; layer)
{
    int max_pay = 0;
    for(int i=0;i&lt;count_num;i++)
    {<br>        dp[i+1]=max(dp[i+1],dp[i]);
        int time = layer[i].first;
        int pay = layer[i].second;</p>
<pre><code>    int pass = time+i;

    if(pass&lt;=count_num)
    {
        dp[pass] = max(dp[pass],dp[i]+pay);
    }
}
cout&lt;&lt;dp[count_num]&lt;&lt;&quot;\n&quot;;</code></pre><p>}</p>
<p>int main()
{
    ios_base::sync_with_stdio(0);</p>
<pre><code>cin &gt;&gt; count_num;

layer.resize(count_num);

dp = new int[count_num+1];

for(int i = 0 ; i&lt;count_num;i++)
{
    cin &gt;&gt; layer[i].first&gt;&gt;layer[i].second;
}

for(int i = 0 ; i&lt;count_num;i++)
{
    dp[i] = 0;
}

soultion_get(layer);</code></pre><p>}</p>
<p>```</p>
<hr>
<p>참고</p>
<p><a href="https://codejin.tistory.com/173">https://codejin.tistory.com/173</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[15655_n&m(6)]]></title>
            <link>https://velog.io/@happy_lee0_0/15655nm6</link>
            <guid>https://velog.io/@happy_lee0_0/15655nm6</guid>
            <pubDate>Fri, 28 Nov 2025 01:47:20 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/fa1e9bad-2014-4f72-81e2-41b5da2bb30b/image.png" alt=""></p>
<p>예제 입력 1 
3 1
4 5 2
예제 출력 1 
2
4
5</p>
<p>예제 입력 2 
4 2
9 8 7 1
예제 출력 2 
1 7
1 8
1 9
7 8
7 9
8 9</p>
<p>예제 입력 3 
4 4
1231 1232 1233 1234
예제 출력 3 
1231 1232 1233 1234</p>
<h3 id="개념-정리">개념 정리</h3>
<h4 id="vectorint-vec">vector<int> vec</h4>
<ul>
<li>C++ 에서 제공하는 정수형 동적 배열선언</li>
<li>초기에는 크기가 0이고 필요한 순간 동적으로 크기 조절이 가능</li>
<li>한줄이라고 생각하면 되는것 우리가 아는 배열 느낌으로</li>
</ul>
<h4 id="ios_basesync_with_stdio0">ios_base::sync_with_stdio(0)</h4>
<ul>
<li>C++의 iostream(cin, cout)과 C의 stdio(scanf, printf) 간의 동기화를 끄는 명령이</li>
<li>이 작업으로 입출력 성능 최적화됨</li>
<li>scanf/printf와 섞어 쓰면 안됨 동기화가 꺼졌기 때문</li>
</ul>
<h4 id="numsresizen">nums.resize(N);</h4>
<ul>
<li>vector의 크기를 N만큼 변경(resize) 하는 명령어</li>
<li>SIZE을 지정하는 것</li>
<li>정렬한후 순서대로 탐색</li>
</ul>
<h4 id="for-const-int-v--vec">for (const int&amp; v : vec)</h4>
<ul>
<li>해당것은 cpp 기반 범위 기반 FOR문임</li>
<li>vec 내부의 원소를 앞에서부터 하나씩 순회</li>
</ul>
<p>동일한 것</p>
<p>for (int i = 0; i &lt; vec.size(); i++) {
    cout &lt;&lt; vec[i] &lt;&lt; &#39; &#39;;
}</p>
<p>또는                      </p>
<p>for (int v : vec) {   // 복사 발생
    cout &lt;&lt; v &lt;&lt; &#39; &#39;;
}</p>
<p>효율화 안전화 특면에서</p>
<p>for (const int&amp; v : vec)</p>
<h2 id="코드">코드</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
using namespace std;

int line, get_out;
vector&lt;int&gt; nums;
vector&lt;int&gt; vec;

void NM(int a, int start)
{
    if(a == get_out)
    {
        for(int i = 0; i &lt; get_out; i++)
            cout &lt;&lt; vec[i] &lt;&lt; &quot; &quot;;
        cout &lt;&lt; &quot;\n&quot;;
        return;
    }

    for(int i = start; i &lt; line; i++)
    {
        vec[a] = nums[i];
        NM(a + 1, i + 1);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin &gt;&gt; line &gt;&gt; get_out;

    nums.resize(line);
    vec.resize(get_out);

    for(int i = 0; i &lt; line; i++)
        cin &gt;&gt; nums[i];

    sort(nums.begin(), nums.end());

    NM(0, 0);
}
</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[다른 PC와 SSH 연결 및 원격제어]]></title>
            <link>https://velog.io/@happy_lee0_0/%EB%8B%A4%EB%A5%B8-PC%EC%99%80-SSH-%EC%97%B0%EA%B2%B0-%EB%B0%8F-%EC%9B%90%EA%B2%A9%EC%A0%9C%EC%96%B4</link>
            <guid>https://velog.io/@happy_lee0_0/%EB%8B%A4%EB%A5%B8-PC%EC%99%80-SSH-%EC%97%B0%EA%B2%B0-%EB%B0%8F-%EC%9B%90%EA%B2%A9%EC%A0%9C%EC%96%B4</guid>
            <pubDate>Fri, 28 Nov 2025 01:42:19 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p>이는 타 pc에 연결할때 내가 보면서 하고 싶어서 만든 것임ㅋ</p>
</blockquote>
<ul>
<li>이는 같은 와이파이상에서 하는 경우를 설명함</li>
<li>나는 wsl에서 접속한지라 wsl이 적혀있음<h2 id="wsl-환경에서-접속하는법">wsl 환경에서 접속하는법</h2>
</li>
</ul>
<h3 id="상대-pc-1-ssh-서버-설치">[상대 PC] 1) SSH 서버 설치</h3>
<p>sudo apt update
sudo apt install openssh-server -y</p>
<p><strong>있는 지 확인하는법
-&gt;which sshd</strong></p>
<h3 id="상대-pc-2-ssh-서비스-활성화">[상대 PC] 2) SSH 서비스 활성화</h3>
<p>sudo systemctl enable ssh
sudo systemctl start ssh
sudo systemctl status ssh</p>
<p><strong>서비스 활성 상태(enable) 확인
-&gt;systemctl is-enabled ssh
답 : enable</strong></p>
<p><strong>서비스 실행 중인지 확인
-&gt;systemctl status ssh
답 : Active: active (running)</strong></p>
<p><strong>SSH 포트(22) 열렸는지 확인
-&gt;ss -tlnp | grep ssh</strong></p>
<h3 id="상대-pc-3-방화벽ufw에서-ssh-허용">[상대 PC] 3) 방화벽(UFW)에서 SSH 허용</h3>
<p>sudo ufw allow ssh
sudo ufw enable
sudo ufw status</p>
<p><strong>UFW 방화벽에서 SSH 허용 여부 확인
-&gt;sudo ufw status verbose</strong></p>
<h3 id="상대-pc-4-서버-ip-확인">[상대 PC] 4) 서버 IP 확인</h3>
<p>ip addr show</p>
<h3 id="wsl-1-상대-pc에-ping-테스트">[WSL] 1) 상대 PC에 ping 테스트</h3>
<p>ping 192.168.0.25</p>
<p>ping이 되면 네트워크 연결 가능
ping이 안되면 Windows 방화벽 또는 네트워크 문제</p>
<h3 id="wsl-2-ssh-접속">[WSL] 2) SSH 접속</h3>
<p>ssh 사용자명@192.168.0.25
예: ssh <a href="mailto:jhlee@192.168.0.25">jhlee@192.168.0.25</a></p>
<p>whoami로 사용자 명을 확인할수 있음</p>
<h3 id="wsl-3-첫-접속-시-fingerprint-등록">[WSL] 3) 첫 접속 시 fingerprint 등록</h3>
<p>Are you sure you want to continue connecting (yes/no)?
→ yes 입력</p>
<h3 id="wsl-4-접속-확인">[WSL] 4) 접속 확인</h3>
<p>user@ubuntu-PC:~$</p>
<h2 id="vscode에서-접속하는법">vscode에서 접속하는법</h2>
<ol>
<li>remote-ssh 다운</li>
<li>f1 클릭</li>
<li>ssh config 작성</li>
<li>C:Users\이름\ssh\config뜸
<img src="https://velog.velcdn.com/images/happy_lee0_0/post/823c9e46-8dc6-49de-b3a9-dd04d52d2695/image.png" alt=""></li>
</ol>
<p>5.기입</p>
<pre><code>Host **ubuntu_server**
    HostName **192.168.0.245**
    User **ros**
    Port **22**</code></pre><ul>
<li>해당부분에서 ubuntu_server는 너가 vscode에 지정할 이름을 작성하는것</li>
<li>hostname은 상대 ip를 작성</li>
<li>user도 상대 이름</li>
<li>port는 일반적이면 22임</li>
</ul>
<ol start="6">
<li>좌측 빨강 클릭후 remotes tunnels 들어간다음 ssh에 너가 만든것이 있으면 성공한것임 이제 하단에 들어가면됨
<img src="https://velog.velcdn.com/images/happy_lee0_0/post/900fe7f4-f193-4a9b-a770-91a959e2e585/image.png" alt=""></li>
</ol>
<hr>
<h3 id="참고">참고</h3>
<p><a href="https://diokim17.tistory.com/13">https://diokim17.tistory.com/13</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[1759_암호만들기]]></title>
            <link>https://velog.io/@happy_lee0_0/1759%EC%95%94%ED%98%B8%EB%A7%8C%EB%93%A4%EA%B8%B0</link>
            <guid>https://velog.io/@happy_lee0_0/1759%EC%95%94%ED%98%B8%EB%A7%8C%EB%93%A4%EA%B8%B0</guid>
            <pubDate>Thu, 27 Nov 2025 02:20:48 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/267cee92-cf88-4f99-9ed3-10bcb145463e/image.png" alt=""></p>
<p>예제 입력 1 
4 6
a t c i s w</p>
<p>예제 출력 1 
acis
acit
aciw
acst
acsw
actw
aist
aisw
aitw
astw
cist
cisw
citw
istw</p>
<h2 id="개념정리">개념정리</h2>
<h3 id="push_back">push_back</h3>
<ul>
<li>push_back이란 vector에서 뒤에 자리에 숫자를 집어 넣음</li>
<li>또는 str.push_back으로 해서 뒤에 문자도 집어넣을수 있음</li>
</ul>
<h3 id="vector-char-nums_line">vector <code>&lt;char&gt;</code> nums_line;</h3>
<ul>
<li>이렇게 vector는 int 뿐만아니라 char로도 할수 있었음</li>
</ul>
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
using namespace std;

int output_line, input_line;

vector&lt;char&gt; nums_line;

void dfs(vector&lt;char&gt; nums_line, int a, string str, int jaum, int moum)
{

    str.push_back(nums_line[a]);
    if(nums_line[a] == &#39;a&#39; || nums_line[a] == &#39;e&#39; || nums_line[a] == &#39;i&#39;|| nums_line[a] == &#39;o&#39;|| nums_line[a] == &#39;u&#39;)
    {
        ++moum;
    }
    else ++jaum;

    if(str.size()==output_line)
    {
        if(moum&gt;=1 &amp;&amp; jaum&gt;=2)
        {
            cout&lt;&lt;str&lt;&lt;&#39;\n&#39;;
        }
    }

    for(int i = a+1;i &lt; input_line;i++)
    {
        dfs(nums_line, i, str, jaum, moum);
    }

}

int main()
{
    ios_base::sync_with_stdio(0);

    cin&gt;&gt;output_line&gt;&gt;input_line;

    nums_line.resize(input_line);

    for(int i = 0 ; i &lt; input_line;i++)
    {
        cin&gt;&gt;nums_line[i];
    }

    sort(nums_line.begin(),nums_line.end());

    for(int i = 0; i &lt; input_line; i++)
        dfs(nums_line,i,&quot;&quot;,0,0);

}



</code></pre><hr>
<p>참고
<a href="https://0m1n.tistory.com/21">https://0m1n.tistory.com/21</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[15654_N과 M(5)]]></title>
            <link>https://velog.io/@happy_lee0_0/15654N%EA%B3%BC-M5-%EC%9E%91%EC%84%B1%EC%A4%91</link>
            <guid>https://velog.io/@happy_lee0_0/15654N%EA%B3%BC-M5-%EC%9E%91%EC%84%B1%EC%A4%91</guid>
            <pubDate>Mon, 24 Nov 2025 01:53:29 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/happy_lee0_0/post/7f5b5d63-aa12-465f-9673-acf086ee5a22/image.png" alt=""></p>
<p>예제 입력 1 
3 1
4 5 2
예제 출력 1 
2
4
5</p>
<p>예제 입력 2 
4 2
9 8 7 1
예제 출력 2 
1 7
1 8
1 9
7 1
7 8
7 9
8 1
8 7
8 9
9 1
9 7
9 8</p>
<p>예제 입력 3 
4 4
1231 1232 1233 1234
예제 출력 3 
1231 1232 1233 1234
1231 1232 1234 1233
1231 1233 1232 1234
1231 1233 1234 1232
1231 1234 1232 1233
1231 1234 1233 1232
1232 1231 1233 1234
1232 1231 1234 1233
1232 1233 1231 1234
1232 1233 1234 1231
1232 1234 1231 1233
1232 1234 1233 1231
1233 1231 1232 1234
1233 1231 1234 1232
1233 1232 1231 1234
1233 1232 1234 1231
1233 1234 1231 1232
1233 1234 1232 1231
1234 1231 1232 1233
1234 1231 1233 1232
1234 1232 1231 1233
1234 1232 1233 1231
1234 1233 1231 1232
1234 1233 1232 1231</p>
<h2 id="code">code</h2>
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;algorithm&gt;
using namespace std;

int input[10];

int output[10];

bool visit[10];

int line, get_out;

void NM(int m)
{
    if(m==line)
    {
        for(int i = 0;i&lt;line;i++)
        {
            cout&lt;&lt;output[i]&lt;&lt;&quot; &quot;;
        }
        cout&lt;&lt;&quot;\n&quot;;
    }
    else
    {
        for(int i = 0 ; i &lt; get_out ;i++)
        {
            if(visit[i]==false)
            {
                output[m] = input[i];
                visit[i]=true;
                NM(1+m);
                visit[i]=false;
            }
        }
    }


}

int main()
{

    cin &gt;&gt; get_out &gt;&gt; line;

    for(int i = 0 ; i&lt;get_out ; i++)
    {   
        cin &gt;&gt;input[i];
    }

    sort(input,input+get_out);

    NM(0);

    return 0;

}</code></pre>]]></description>
        </item>
    </channel>
</rss>