<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>파싱 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/%ed%8c%8c%ec%8b%b1/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Tue, 25 Feb 2025 09:25:07 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>파싱 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Unity Serialization (직렬화)</title>
		<link>https://lycos7560.com/unity/unity-serialization-%ec%a7%81%eb%a0%ac%ed%99%94/39882/</link>
					<comments>https://lycos7560.com/unity/unity-serialization-%ec%a7%81%eb%a0%ac%ed%99%94/39882/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 25 Feb 2025 09:24:30 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Byte Stream]]></category>
		<category><![CDATA[Configuration Files]]></category>
		<category><![CDATA[Data Format]]></category>
		<category><![CDATA[Data Storage]]></category>
		<category><![CDATA[Data Structure]]></category>
		<category><![CDATA[data transfer]]></category>
		<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[Dictionary]]></category>
		<category><![CDATA[file saving]]></category>
		<category><![CDATA[Game Data]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Game State Saving]]></category>
		<category><![CDATA[Inspector]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[JsonUtility]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Load System]]></category>
		<category><![CDATA[Memory Management]]></category>
		<category><![CDATA[Newtonsoft.Json]]></category>
		<category><![CDATA[Object Conversion]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[PlayerPrefs]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Readability]]></category>
		<category><![CDATA[Runtime]]></category>
		<category><![CDATA[Save System]]></category>
		<category><![CDATA[Scene Management]]></category>
		<category><![CDATA[ScriptableObject]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Serialization]]></category>
		<category><![CDATA[Serialization Rules]]></category>
		<category><![CDATA[SerializeField]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[System.Serializable]]></category>
		<category><![CDATA[Unity Editor]]></category>
		<category><![CDATA[Variable Types]]></category>
		<category><![CDATA[WebSockets]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[YAML]]></category>
		<category><![CDATA[가독성]]></category>
		<category><![CDATA[개발자도구]]></category>
		<category><![CDATA[객체변환]]></category>
		<category><![CDATA[게임개발]]></category>
		<category><![CDATA[게임데이터]]></category>
		<category><![CDATA[게임상태저장]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[데이터구조]]></category>
		<category><![CDATA[데이터저장]]></category>
		<category><![CDATA[데이터전송]]></category>
		<category><![CDATA[데이터포맷]]></category>
		<category><![CDATA[런타임]]></category>
		<category><![CDATA[로드시스템]]></category>
		<category><![CDATA[메모리관리]]></category>
		<category><![CDATA[바이트스트림]]></category>
		<category><![CDATA[변수타입]]></category>
		<category><![CDATA[설정파일]]></category>
		<category><![CDATA[스크립팅]]></category>
		<category><![CDATA[씬관리]]></category>
		<category><![CDATA[웹소켓]]></category>
		<category><![CDATA[유니티에디터]]></category>
		<category><![CDATA[직렬화]]></category>
		<category><![CDATA[직렬화규칙]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[파일저장]]></category>
		<category><![CDATA[프로그래밍]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=39882</guid>

					<description><![CDATA[<p>🔥 Serialization (직렬화) 개요 Serialization이란 객체 데이터를 바이트 스트림으로 변환하여 저장하거나 전송할 수 있도록 하는 과정 주 목적은 필요할 때 다시 개체로 만들 수 있도록 개체의 상태를 저장하는 것 반대로 Deserialization은 저장된 바이트 데이터를 다시 객체로 변환하는 과정입니다. 🔥 JSON, XML, YAML 일반적으로 많이 사용하는 데이터 직렬화 포맷들 1️⃣ JSON (JavaScript Object Notation) ✔️ 특징 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/unity/unity-serialization-%ec%a7%81%eb%a0%ac%ed%99%94/39882/">Unity Serialization (직렬화)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-571189ff      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#serialization-직렬화-개요" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Serialization (직렬화) 개요</a><li class="uagb-toc__list"><a href="#json-xml-yaml" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JSON, XML, YAML</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#1-json-javascript-object-notation" class="uagb-toc-link__trigger">1&#x20e3; JSON (JavaScript Object Notation)</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#2-xml-extensible-markup-language" class="uagb-toc-link__trigger">2&#x20e3; XML (eXtensible Markup Language)</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#3-yaml-yaml-aint-markup-language" class="uagb-toc-link__trigger">3&#x20e3; YAML (YAML Ain&#039;t Markup Language)</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#비교-정리" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f50e.png" alt="🔎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 비교 정리</a></li></ul></li><li class="uagb-toc__list"><a href="#unity에서의-스크립트-직렬화-serialization-in-unity" class="uagb-toc-link__trigger"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" />Unity에서의 스크립트 직렬화 (Serialization in Unity)</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#1-unity에서-직렬화가-중요한-이유" class="uagb-toc-link__trigger">1&#x20e3; Unity에서 직렬화가 중요한 이유</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#2-unity에서-직렬화-가능한-타입" class="uagb-toc-link__trigger">2&#x20e3; Unity에서 직렬화 가능한 타입</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#3-unity-직렬화-적용-방법" class="uagb-toc-link__trigger">3&#x20e3; Unity 직렬화 적용 방법</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#4-unity-직렬화와-json-활용" class="uagb-toc-link__trigger">4&#x20e3; Unity 직렬화와 JSON 활용</a></ul></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Serialization (직렬화) 개요</strong></h2>



<p><strong>Serialization</strong>이란<strong> 객체 데이터</strong>를 <strong>바이트 스트림</strong>으로 변환하여 <strong>저장</strong>하거나 <strong>전송</strong>할 수 있도록 하는 과정</p>



<p>주 목적은 필요할 때 다시 개체로 만들 수 있도록 개체의 상태를 저장하는 것</p>



<p>반대로 <strong>Deserialization</strong>은 저장된 바이트 데이터를 다시 객체로 변환하는 과정입니다.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="262" height="199" src="https://lycos7560.com/wp-content/uploads/2025/02/image-179.png" alt="" class="wp-image-39884"/><figcaption class="wp-element-caption"><a href="https://learn.microsoft.com/ko-kr/dotnet/visual-basic/programming-guide/concepts/serialization/" target="_blank" rel="noreferrer noopener">https://learn.microsoft.com/ko-kr/dotnet/visual-basic/programming-guide/concepts/serialization/</a></figcaption></figure>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h2 class="wp-block-heading"><strong><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></strong> JSON, XML, YAML</h2>



<p>일반적으로 많이 사용하는 데이터 직렬화 포맷들</p>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30)"/>



<h3 class="wp-block-heading">1&#x20e3; JSON (JavaScript Object Notation)</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 특징</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 가벼운 텍스트 기반 포맷<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 사람이 읽고 쓰기 쉬우며, 기계가 빠르게 처리 가능<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 대부분의 프로그래밍 언어에서 지원 (C#, Python, JavaScript 등)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 키-값 쌍의 구조 (Dictionary, Object와 유사)</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 예제</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="json" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">{
  "name": "John",
  "age": 30,
  "skills": ["C#", "Unity", "Python"],
  "isDeveloper": true
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 장점</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 가볍고 속도가 빠름<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 대부분의 언어에서 지원<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> API 및 데이터 전송에 적합 (REST API, WebSockets 등)</p>



<h4 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 단점</strong></h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 주석 지원이 안됨<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> XML이나 YAML보다 덜 유연함</p>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h3 class="wp-block-heading">2&#x20e3; XML (eXtensible Markup Language)</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 특징</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 데이터 구조를 계층적으로 표현 (HTML과 유사)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 사람이 읽을 수 있지만, JSON보다 길이가 김<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 다양한 도메인에서 사용 (문서 저장, 설정 파일, 웹 서비스 등)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> &lt;태그&gt;를 이용한 구조화된 데이터 표현</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 예제</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;Person>
    &lt;Name>John&lt;/Name>
    &lt;Age>30&lt;/Age>
    &lt;Skills>
        &lt;Skill>C#&lt;/Skill>
        &lt;Skill>Unity&lt;/Skill>
        &lt;Skill>Python&lt;/Skill>
    &lt;/Skills>
    &lt;IsDeveloper>true&lt;/IsDeveloper>
&lt;/Person>
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 장점</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 데이터 구조가 명확함<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 주석 사용 가능 (&lt;!&#8211; 주석 &#8211;&gt;)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 다양한 데이터 타입을 표현하기 적합</p>



<h4 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 단점</strong></h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JSON보다 크기가 크고, 가독성이 떨어짐<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 파싱 속도가 느림</p>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h3 class="wp-block-heading">3&#x20e3; YAML (YAML Ain&#8217;t Markup Language)</h3>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 특징</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JSON과 유사하지만 더 간결한 문법을 가짐<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 들여쓰기를 이용한 계층 구조 (Python과 유사)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 설정 파일에서 많이 사용 (Docker, Kubernetes, Unity Config 등)</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 예제</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="yaml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">name: John
age: 30
skills:
  - C#
  - Unity
  - Python
isDeveloper: true
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 장점</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 사람이 읽기 쉬운 직관적인 문법<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JSON보다 간결하여 가독성이 좋음<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 주석 (#) 사용 가능</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 단점</strong></h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 들여쓰기 실수로 인한 오류 발생 가능<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 파싱 속도가 JSON보다 느림</p>



<figure class="wp-block-image size-full"><img decoding="async" width="727" height="481" src="https://lycos7560.com/wp-content/uploads/2025/02/image-180.jpg" alt="" class="wp-image-39885" srcset="https://lycos7560.com/wp-content/uploads/2025/02/image-180.jpg 727w, https://lycos7560.com/wp-content/uploads/2025/02/image-180-300x198.jpg 300w" sizes="(max-width: 727px) 100vw, 727px" /><figcaption class="wp-element-caption">Unity의 YAML<br><a href="https://unity.com/kr/blog/engine-platform/understanding-unitys-serialization-language-yaml" target="_blank" rel="noreferrer noopener">https://unity.com/kr/blog/engine-platform/understanding-unitys-serialization-language-yaml</a></figcaption></figure>



<hr class="wp-block-separator has-alpha-channel-opacity" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)"/>



<h3 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f50e.png" alt="🔎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 비교 정리</strong></h3>



<p>Unity에서는 JSON (JsonUtility, Newtonsoft.Json)이 가장 많이 사용되며, YAML은 Unity의 설정 파일 (.yml)에서 많이 활용됩니다.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>형식</th><th>문법</th><th>가독성</th><th>속도</th><th>사용 사례</th></tr></thead><tbody><tr><td><strong>JSON</strong></td><td><code>{ "key": "value" }</code></td><td>좋음</td><td>빠름 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>API, 데이터 저장</td></tr><tr><td><strong>XML</strong></td><td><code>&lt;tag&gt;value&lt;/tag&gt;</code></td><td>중간</td><td>느림 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>문서 저장, 설정 파일</td></tr><tr><td><strong>YAML</strong></td><td><code>key: value</code> (들여쓰기)</td><td>매우 좋음 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>중간</td><td>설정 파일, DevOps</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="1620" height="714" src="https://lycos7560.com/wp-content/uploads/2025/02/image-180.png" alt="" class="wp-image-39886" style="width:771px;height:auto" srcset="https://lycos7560.com/wp-content/uploads/2025/02/image-180.png 1620w, https://lycos7560.com/wp-content/uploads/2025/02/image-180-300x132.png 300w, https://lycos7560.com/wp-content/uploads/2025/02/image-180-768x338.png 768w, https://lycos7560.com/wp-content/uploads/2025/02/image-180-1536x677.png 1536w" sizes="(max-width: 1620px) 100vw, 1620px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h2 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" />Unity에서의 스크립트 직렬화 (Serialization in Unity)</strong></h2>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h3 class="wp-block-heading">1&#x20e3; <strong>Unity에서 직렬화가 중요한 이유</strong></h3>



<p>Unity는 <strong>Inspector 창에서 데이터를 유지</strong>하거나 <strong>저장 시스템(예: PlayerPrefs, JSON, Binary 파일 등)에 데이터를 저장</strong>하기 위해 직렬화를 활용합니다.</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>씬(Scene) 저장 및 로드</strong>: Inspector에 입력한 값이 유지됨<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>ScriptableObject:</strong> 게임 데이터 관리<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Save/Load 시스템</strong>: JSON 또는 Binary 직렬화를 활용하여 파일 저장</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h3 class="wp-block-heading">2&#x20e3; <strong>Unity에서 직렬화 가능한 타입</strong></h3>



<p><a href="https://docs.unity3d.com/6000.0/Documentation/Manual/script-serialization-rules.html" target="_blank" rel="noreferrer noopener">https://docs.unity3d.com/6000.0/Documentation/Manual/script-serialization-rules.html</a></p>



<p>Unity는 <strong>특정 데이터 타입만 직렬화할 수 있도록 제한</strong>하고 있습니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2b55.png" alt="⭕" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 직렬화 가능한 타입 (Serializable)</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>기본 데이터 타입</strong>: <code>int</code>, <code>float</code>, <code>bool</code>, <code>string</code> 등<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Unity 기본 타입</strong>: <strong>배열 &amp; 리스트</strong>: <code>int[]</code>, <code>List&lt;float&gt;</code> 등 (단, <code>public</code> 또는 <code>[SerializeField]</code> 필요)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>사용자 정의 클래스</strong> (<code>[System.Serializable]</code> 필요)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>ScriptableObject</strong></p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong> 직렬화 불가능한 타입 (Non-Serializable)</h4>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>딕셔너리(Dictionary)</strong><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>다차원 배열 (<code>int[,]</code>)</strong><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong><strong>속성(Property) (getter/setter)</strong></strong><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong><strong>Static 변수 (<code>static</code>)</strong></strong><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong><strong>추상 클래스 &amp; 인터페이스</strong></strong><br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong><strong>델리게이트(Delegate), 이벤트(Event)</strong></strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h3 class="wp-block-heading">3&#x20e3; <strong>Unity 직렬화 적용 방법</strong></h3>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> [SerializeField]</h4>



<p><code>private</code> 변수도 Inspector에서 보이도록 만들고, 직렬화 가능하게 합니다.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using UnityEngine;

public class Player : MonoBehaviour
{
    [SerializeField] private int health = 100;  // 직렬화됨 (Inspector에서 수정 가능)
    private int score = 0;  // 직렬화되지 않음 (Inspector에서 보이지 않음)
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> [SerializeField]를 사용하면 <code>private</code> 변수도 직렬화됨<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 하지만 <code>static</code>, <code>const</code>, <code>readonly</code> 변수는 직렬화되지 않음</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> [System.Serializable]</h4>



<p>사용자 정의 클래스를 직렬화하려면 <code>[System.Serializable]</code>을 붙여야 합니다.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using UnityEngine;

[System.Serializable]  
public class Weapon
{
    public string name;
    public int damage;
}

public class Player : MonoBehaviour
{
    public Weapon myWeapon;  // Weapon 클래스가 직렬화되므로 Inspector에서 수정 가능
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 클래스를 <code>System.Serializable</code>로 만들면 Unity Inspector에서 확인 가능<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 하지만 <code>Dictionary</code>, <code>Properties</code>, <code>Static 변수</code> 등은 여전히 직렬화되지 않음</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ScriptableObject</h4>



<p>게임 데이터를 저장 및 관리하는 특수한 직렬화 객체</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using UnityEngine;

[CreateAssetMenu(fileName = "New Weapon", menuName = "Weapon")]
public class WeaponData : ScriptableObject
{
    public string weaponName;
    public int damage;
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 씬(Scene)과 독립적으로 데이터 관리 가능<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 메모리 효율적 관리 가능 (오브젝트 풀링, 설정 저장 등)<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 런타임에서 수정된 값은 저장되지 않음 (Play 모드가 끝나면 초기화됨)</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-default" style="margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50)"/>



<h3 class="wp-block-heading">4&#x20e3; <strong>Unity 직렬화와 JSON 활용</strong></h3>



<p>Unity에서 JSON 직렬화를 활용하면 <strong>데이터 저장 &amp; 로드</strong>가 가능해집니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JsonUtility (빠르지만 제한적)</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using UnityEngine;

[System.Serializable]
public class PlayerData
{
    public string name;
    public int level;
}

public class SaveLoadSystem : MonoBehaviour
{
    void Start()
    {
        PlayerData player = new PlayerData { name = "John", level = 10 };
        string json = JsonUtility.ToJson(player);
        Debug.Log(json);  // {"name":"John","level":10}

        PlayerData loadedPlayer = JsonUtility.FromJson&lt;PlayerData>(json);
        Debug.Log(loadedPlayer.name);  // John
    }
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 빠름 &amp; Unity 기본 지원<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Dictionary, List&lt;T&gt; 같은 복잡한 자료형 지원 X</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Newtonsoft.Json (더 강력한 JSON 직렬화)</h4>



<p><code>Newtonsoft.Json</code> 라이브러리를 사용하면 <strong>Dictionary, List, Interface 등도 직렬화 가능</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">using UnityEngine;
using Newtonsoft.Json;
using System.Collections.Generic;

public class PlayerData
{
    public string name;
    public int level;
    public Dictionary&lt;string, int> inventory = new Dictionary&lt;string, int>();
}

public class SaveLoadSystem : MonoBehaviour
{
    void Start()
    {
        PlayerData player = new PlayerData { name = "John", level = 10 };
        player.inventory.Add("Sword", 1);
        player.inventory.Add("Potion", 5);

        string json = JsonConvert.SerializeObject(player, Formatting.Indented);
        Debug.Log(json);

        PlayerData loadedPlayer = JsonConvert.DeserializeObject&lt;PlayerData>(json);
        Debug.Log(loadedPlayer.inventory["Sword"]);  // 1
    }
}
</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Dictionary, List&lt;T&gt; 등 복잡한 자료형 지원<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> JsonUtility보다 속도가 느림<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 추가 라이브러리 설치 필요 (<code>Newtonsoft.Json.dll</code>)</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="[유니티 TIPS] 데이터 시리얼라이제이션 완전 정복하기" width="1778" height="1000" src="https://www.youtube.com/embed/kEu_AQ_Es-8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption">공부 참고 영상</figcaption></figure>



<p></p>
<p>The post <a href="https://lycos7560.com/unity/unity-serialization-%ec%a7%81%eb%a0%ac%ed%99%94/39882/">Unity Serialization (직렬화)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/unity/unity-serialization-%ec%a7%81%eb%a0%ac%ed%99%94/39882/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Programmers 72410 신규 아이디 추천 [2021 KAKAO BLIND RECRUITMENT]</title>
		<link>https://lycos7560.com/cpp/programmers/programmers-72410-%ec%8b%a0%ea%b7%9c-%ec%95%84%ec%9d%b4%eb%94%94-%ec%b6%94%ec%b2%9c-2021-kakao-blind-recruitment/34792/</link>
					<comments>https://lycos7560.com/cpp/programmers/programmers-72410-%ec%8b%a0%ea%b7%9c-%ec%95%84%ec%9d%b4%eb%94%94-%ec%b6%94%ec%b2%9c-2021-kakao-blind-recruitment/34792/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 14 May 2023 21:25:12 +0000</pubDate>
				<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[programmers]]></category>
		<category><![CDATA[[2021 KAKAO BLIND RECRUITMENT]]]></category>
		<category><![CDATA[<string>]]></category>
		<category><![CDATA[2021 KAKAO BLIND RECRUITMENT]]></category>
		<category><![CDATA[72410]]></category>
		<category><![CDATA[72410번]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Programmers 72410]]></category>
		<category><![CDATA[Programmers 72410번]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[신규 아이디 추천]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[프로그래머스]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34792</guid>

					<description><![CDATA[<p>Programmers 72410번 '신규 아이디 추천' 문제에 대한 글입니다. (This article is about the 'New ID Recommendation' problem in Programmers Number 72410) [2021 KAKAO BLIND RECRUITMENT]</p>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-72410-%ec%8b%a0%ea%b7%9c-%ec%95%84%ec%9d%b4%eb%94%94-%ec%b6%94%ec%b2%9c-2021-kakao-blind-recruitment/34792/">Programmers 72410 신규 아이디 추천 [2021 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-8d2b0414      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#신규-아이디-추천" class="uagb-toc-link__trigger">신규 아이디 추천</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a><li class="uagb-toc__list"><a href="#더-효율적인-코드" class="uagb-toc-link__trigger">더 효율적인 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">신규 아이디 추천</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/72410" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/72410</a></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">카카오에 입사한 신입 개발자 <code>네오</code>는 &#8220;카카오계정개발팀&#8221;에 배치되어, </p>



<p class="has-medium-font-size">카카오 서비스에 가입하는 유저들의 아이디를 생성하는 업무를 담당하게 되었습니다. </p>



<p class="has-medium-font-size">&#8220;네오&#8221;에게 주어진 첫 업무는 새로 가입하는 유저들이 카카오 아이디 규칙에 맞지 않는 아이디를 입력했을 때, </p>



<p class="has-medium-font-size">입력된 아이디와 유사하면서 규칙에 맞는 아이디를 추천해주는 프로그램을 개발하는 것입니다.</p>



<p class="has-medium-font-size">다음은 카카오 아이디의 규칙입니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<ul class="wp-block-list">
<li>아이디의 길이는 3자 이상 15자 이하여야 합니다.</li>



<li>아이디는 알파벳 소문자, 숫자, 빼기(<code>-</code>), 밑줄(<code>_</code>), 마침표(<code>.</code>) 문자만 사용할 수 있습니다.</li>



<li>단, 마침표(<code>.</code>)는 처음과 끝에 사용할 수 없으며 또한 연속으로 사용할 수 없습니다.</li>
</ul>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">&#8220;네오&#8221;는 다음과 같이 7단계의 순차적인 처리 과정을 통해 </p>



<p class="has-medium-font-size">신규 유저가 입력한 아이디가 카카오 아이디 규칙에 맞는 지 검사하고 규칙에 맞지 않은 경우 </p>



<p class="has-medium-font-size">규칙에 맞는 새로운 아이디를 추천해 주려고 합니다.</p>



<p class="has-medium-font-size">신규 유저가 입력한 아이디가 <code>new_id</code> 라고 한다면,</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">1단계 new_id의 모든 대문자를 대응되는 소문자로 치환합니다.
2단계 new_id에서 알파벳 소문자, 숫자, 빼기(-), 밑줄(_), 마침표(.)를 제외한 모든 문자를 제거합니다.
3단계 new_id에서 마침표(.)가 2번 이상 연속된 부분을 하나의 마침표(.)로 치환합니다.
4단계 new_id에서 마침표(.)가 처음이나 끝에 위치한다면 제거합니다.
5단계 new_id가 빈 문자열이라면, new_id에 "a"를 대입합니다.
6단계 new_id의 길이가 16자 이상이면, new_id의 첫 15개의 문자를 제외한 나머지 문자들을 모두 제거합니다.
     만약 제거 후 마침표(.)가 new_id의 끝에 위치한다면 끝에 위치한 마침표(.) 문자를 제거합니다.
7단계 new_id의 길이가 2자 이하라면, new_id의 마지막 문자를 new_id의 길이가 3이 될 때까지 반복해서 끝에 붙입니다.</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">예를 들어, new_id 값이 &#8220;&#8230;!@BaT#*..y.abcdefghijklm&#8221; 라면, </p>



<p class="has-medium-font-size">위 7단계를 거치고 나면 new_id는 아래와 같이 변경됩니다.</p>



<p class="has-medium-font-size">1단계 대문자 &#8216;B&#8217;와 &#8216;T&#8217;가 소문자 &#8216;b&#8217;와 &#8216;t&#8217;로 바뀌었습니다.<br><code>"...!@BaT#*..y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>"...!@bat#*..y.abcdefghijklm"</code></p>



<p class="has-medium-font-size">2단계 &#8216;!&#8217;, &#8216;@&#8217;, &#8216;#&#8217;, &#8216;*&#8217; 문자가 제거되었습니다.<br><code>"...!@bat#*..y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>"...bat..y.abcdefghijklm"</code></p>



<p class="has-medium-font-size">3단계 &#8216;&#8230;&#8217;와 &#8216;..&#8217; 가 &#8216;.&#8217;로 바뀌었습니다.<br><code>"...bat..y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>".bat.y.abcdefghijklm"</code></p>



<p class="has-medium-font-size">4단계 아이디의 처음에 위치한 &#8216;.&#8217;가 제거되었습니다.<br><code>".bat.y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>"bat.y.abcdefghijklm"</code></p>



<p class="has-medium-font-size">5단계 아이디가 빈 문자열이 아니므로 변화가 없습니다.<br><code>"bat.y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>"bat.y.abcdefghijklm"</code></p>



<p class="has-medium-font-size">6단계 아이디의 길이가 16자 이상이므로, 처음 15자를 제외한 나머지 문자들이 제거되었습니다.<br><code>"bat.y.abcdefghijklm"</code>&nbsp;→&nbsp;<code>"bat.y.abcdefghi"</code></p>



<p class="has-medium-font-size">7단계 아이디의 길이가 2자 이하가 아니므로 변화가 없습니다.<br><code>"bat.y.abcdefghi"</code>&nbsp;→&nbsp;<code>"bat.y.abcdefghi"</code></p>



<p class="has-medium-font-size">따라서 신규 유저가 입력한 new_id가 &#8220;&#8230;!@BaT#*..y.abcdefghijklm&#8221;일 때, </p>



<p class="has-medium-font-size">네오의 프로그램이 추천하는 새로운 아이디는 &#8220;bat.y.abcdefghi&#8221; 입니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[문제]</strong></h2>



<p class="has-medium-font-size">신규 유저가 입력한 아이디를 나타내는 new_id가 매개변수로 주어질 때, </p>



<p class="has-medium-font-size">&#8220;네오&#8221;가 설계한 7단계의 처리 과정을 거친 후의 추천 아이디를 return 하도록 solution 함수를 완성해 주세요.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[제한사항]</strong></h2>



<p class="has-medium-font-size">new_id는 길이 1 이상 1,000 이하인 문자열입니다.</p>



<p class="has-medium-font-size">new_id는 알파벳 대문자, 알파벳 소문자, 숫자, 특수문자로 구성되어 있습니다.</p>



<p class="has-medium-font-size">new_id에 나타날 수 있는 특수문자는 <code>-_.~!@#$%^&amp;*()=+[{]}:?,&lt;>/</code> 로 한정됩니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[입출력 예]</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">no</th><th class="has-text-align-left" data-align="left">new_id</th><th class="has-text-align-left" data-align="left">result</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">예1</td><td class="has-text-align-left" data-align="left"><code>"...!@BaT#*..y.abcdefghijklm"</code></td><td class="has-text-align-left" data-align="left"><code>"bat.y.abcdefghi"</code></td></tr><tr><td class="has-text-align-left" data-align="left">예2</td><td class="has-text-align-left" data-align="left"><code>"z-+.^."</code></td><td class="has-text-align-left" data-align="left"><code>"z--"</code></td></tr><tr><td class="has-text-align-left" data-align="left">예3</td><td class="has-text-align-left" data-align="left"><code>"=.="</code></td><td class="has-text-align-left" data-align="left"><code>"aaa"</code></td></tr><tr><td class="has-text-align-left" data-align="left">예4</td><td class="has-text-align-left" data-align="left"><code>"123_.def"</code></td><td class="has-text-align-left" data-align="left"><code>"123_.def"</code></td></tr><tr><td class="has-text-align-left" data-align="left">예5</td><td class="has-text-align-left" data-align="left"><code>"abcdefghijklmn.p"</code></td><td class="has-text-align-left" data-align="left"><code>"abcdefghijklmn"</code></td></tr></tbody></table></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>입출력 예에 대한 설명</strong></h2>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="has-medium-font-size"><strong>입출력 예 #1</strong></p>



<p class="has-medium-font-size">문제의 예시와 같습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #2</strong></p>



<p class="has-medium-font-size">7단계를 거치는 동안 new_id가 변화하는 과정은 아래와 같습니다.</p>



<p class="has-medium-font-size">1단계 변화 없습니다.<br>2단계&nbsp;<code>"z-+.^."</code>&nbsp;→&nbsp;<code>"z-.."</code><br>3단계&nbsp;<code>"z-.."</code>&nbsp;→&nbsp;<code>"z-."</code><br>4단계&nbsp;<code>"z-."</code>&nbsp;→&nbsp;<code>"z-"</code><br>5단계 변화 없습니다.<br>6단계 변화 없습니다.<br>7단계&nbsp;<code>"z-"</code>&nbsp;→&nbsp;<code>"z--"</code></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #3</strong></p>



<p class="has-medium-font-size">7단계를 거치는 동안 new_id가 변화하는 과정은 아래와 같습니다.</p>



<p class="has-medium-font-size">1단계 변화 없습니다.<br>2단계&nbsp;<code>"=.="</code>&nbsp;→&nbsp;<code>"."</code><br>3단계 변화 없습니다.<br>4단계&nbsp;<code>"."</code>&nbsp;→&nbsp;<code>""</code>&nbsp;(new_id가 빈 문자열이 되었습니다.)<br>5단계&nbsp;<code>""</code>&nbsp;→&nbsp;<code>"a"</code><br>6단계 변화 없습니다.<br>7단계&nbsp;<code>"a"</code>&nbsp;→&nbsp;<code>"aaa"</code></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #4</strong></p>



<p class="has-medium-font-size">1단계에서 7단계까지 거치는 동안 new_id(&#8220;123_.def&#8221;)는 변하지 않습니다. </p>



<p class="has-medium-font-size">즉, new_id가 처음부터 카카오의 아이디 규칙에 맞습니다.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #5</strong></p>



<p class="has-medium-font-size">1단계 변화 없습니다.<br>2단계 변화 없습니다.<br>3단계 변화 없습니다.<br>4단계 변화 없습니다.<br>5단계 변화 없습니다.<br>6단계 <code>"abcdefghijklmn.p"</code> → <code>"abcdefghijklmn."</code> → <code>"abcdefghijklmn"</code><br>7단계 변화 없습니다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;iostream>

using namespace std;

string solution(string new_id) {

    string answer = "";

	// 1단계
	for (int i = 0; i &lt; new_id.length(); i++) {
		if (new_id[i] >= 65 &amp;&amp; new_id[i] &lt;= 90)
			new_id[i] += 32;
	}

	// 2단계
	for (int i = 0; i &lt; new_id.length(); i++) {
		if ((new_id[i] >= 97 &amp;&amp; new_id[i] &lt;= 122) || new_id[i] == '-' || new_id[i] == '_' 
			|| new_id[i] == '.' || (new_id[i] >= 48 &amp;&amp; new_id[i] &lt;= 57))
			answer.push_back(new_id[i]);	
	}

	// 3단계
	new_id = answer;
	answer = "";
	bool check = false;
	for (int i = 0; i &lt; new_id.length(); i++) {
		if (new_id[i] == '.') {
			if (check) continue;
			answer.push_back(new_id[i]);
			check = true;
			continue;
		}
		answer.push_back(new_id[i]);
		check = false;
	}

	//4단계
	while (true) {
		if (answer[0] == '.')  {
			answer.erase(answer.begin());
			continue;
		}
		if (answer[answer.length() - 1] == '.') {
			answer.erase(answer.begin() + answer.length() - 1);
			continue;
		}
		break;
	}

	// 5단계
	if (answer.length() == 0) answer.push_back('a');
	
	// 6단계
	if (answer.length() >= 16) {
		answer = answer.substr(0, 15);
		while (true) {
			if (answer[answer.length() - 1] == '.') {
				answer.erase(answer.begin() + answer.length() - 1);
				continue;
			}
			break;
		}
	}

	// 7단계
	while (answer.length() &lt; 3) {
		answer.push_back(answer[answer.length() - 1]);
	}

    return answer;
}</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="414" height="698" src="https://lycos7560.com/wp-content/uploads/2023/05/image-84.png" alt="" class="wp-image-34799" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-84.png 414w, https://lycos7560.com/wp-content/uploads/2023/05/image-84-178x300.png 178w" sizes="(max-width: 414px) 100vw, 414px" /></figure>



<div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">더 효율적인 코드</h1>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/72410/solution_groups?language=cpp" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/72410/solution_groups?language=cpp</a></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;bits/stdc++.h>
using namespace std;

string solution(string new_id) {
    for (char&amp; ch : new_id) if ('A' &lt;= ch &amp;&amp; ch &lt;= 'Z') ch |= 32;

    string ret;
    for (char&amp; ch: new_id) {
        if ('a' &lt;= ch &amp;&amp; ch &lt;= 'z' ||
            '0' &lt;= ch &amp;&amp; ch &lt;= '9' ||
            strchr("-_.", ch)) ret += ch;
    }

    new_id = ret;
    ret.clear();
    for (char&amp; ch: new_id) {
        if (!ret.empty() &amp;&amp; ret.back() == '.' &amp;&amp; ch == '.') continue;
        ret += ch;
    }

    if (ret.front() == '.') ret.erase(ret.begin());
    if (ret.back() == '.') ret.pop_back();

    if (ret.empty()) ret = "a";
    if (ret.size() >= 16) ret = ret.substr(0, 15);
    if (ret.back() == '.') ret.pop_back();
    while (ret.size() &lt;= 2) ret += ret.back();

    return ret;
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="399" height="711" src="https://lycos7560.com/wp-content/uploads/2023/05/image-85.png" alt="" class="wp-image-34802" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-85.png 399w, https://lycos7560.com/wp-content/uploads/2023/05/image-85-168x300.png 168w" sizes="(max-width: 399px) 100vw, 399px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-72410-%ec%8b%a0%ea%b7%9c-%ec%95%84%ec%9d%b4%eb%94%94-%ec%b6%94%ec%b2%9c-2021-kakao-blind-recruitment/34792/">Programmers 72410 신규 아이디 추천 [2021 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/programmers/programmers-72410-%ec%8b%a0%ea%b7%9c-%ec%95%84%ec%9d%b4%eb%94%94-%ec%b6%94%ec%b2%9c-2021-kakao-blind-recruitment/34792/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Programmers 72414 광고 삽입 [2021 KAKAO BLIND RECRUITMENT]</title>
		<link>https://lycos7560.com/cpp/programmers/programmers-72414-%ea%b4%91%ea%b3%a0-%ec%82%bd%ec%9e%85-2021-kakao-blind-recruitment/34776/</link>
					<comments>https://lycos7560.com/cpp/programmers/programmers-72414-%ea%b4%91%ea%b3%a0-%ec%82%bd%ec%9e%85-2021-kakao-blind-recruitment/34776/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 14 May 2023 13:39:28 +0000</pubDate>
				<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[programmers]]></category>
		<category><![CDATA[[2021 KAKAO BLIND RECRUITMENT]]]></category>
		<category><![CDATA[2021 KAKAO BLIND RECRUITMENT]]></category>
		<category><![CDATA[72414]]></category>
		<category><![CDATA[72414번]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[Programmers 72414]]></category>
		<category><![CDATA[Programmers 72414번]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[광고 삽입]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[타임라인]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[파싱(parsing)]]></category>
		<category><![CDATA[프로그래머스]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34776</guid>

					<description><![CDATA[<p>Programmers 72414번 '광고 삽입' 문제에 대한 글입니다. (This article is about the 'insert advertisement' problem in Programmers Number 72414.) [2021 KAKAO BLIND RECRUITMENT]</p>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-72414-%ea%b4%91%ea%b3%a0-%ec%82%bd%ec%9e%85-2021-kakao-blind-recruitment/34776/">Programmers 72414 광고 삽입 [2021 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-01c05211      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#광고-삽입" class="uagb-toc-link__trigger">광고 삽입</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">광고 삽입</h1>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/72414" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/72414</a></p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제 설명</h2>



<p class="has-medium-font-size"><code>카카오TV</code>에서 유명한 크리에이터로 활동 중인 <code>죠르디</code>는 환경 단체로부터 </p>



<p class="has-medium-font-size">자신의 가장 인기있는 동영상에 지구온난화의 심각성을 알리기 위한 공익광고를 넣어 달라는 요청을 받았습니다. </p>



<p class="has-medium-font-size">평소에 환경 문제에 관심을 가지고 있던 &#8220;죠르디&#8221;는 요청을 받아들였고 </p>



<p class="has-medium-font-size">광고효과를 높이기 위해 시청자들이 가장 많이 보는 구간에 공익광고를 넣으려고 합니다. </p>



<p class="has-medium-font-size">&#8220;죠르디&#8221;는 시청자들이 해당 동영상의 어떤 구간을 재생했는 지 알 수 있는 재생구간 기록을 구했고, </p>



<p class="has-medium-font-size">해당 기록을 바탕으로 공익광고가 삽입될 최적의 위치를 고를 수 있었습니다.</p>



<p class="has-medium-font-size">참고로 광고는 재생 중인 동영상의 오른쪽 아래에서 원래 영상과 <code>동시에 재생되는</code> PIP(Picture in Picture) 형태로 제공됩니다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="989" height="560" src="https://lycos7560.com/wp-content/uploads/2023/05/image-80.jpg" alt="" class="wp-image-34777" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-80.jpg 989w, https://lycos7560.com/wp-content/uploads/2023/05/image-80-300x170.jpg 300w, https://lycos7560.com/wp-content/uploads/2023/05/image-80-768x435.jpg 768w" sizes="(max-width: 989px) 100vw, 989px" /></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">다음은 &#8220;죠르디&#8221;가 공익광고가 삽입될 최적의 위치를 고르는 과정을 그림으로 설명한 것입니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1090" height="355" src="https://lycos7560.com/wp-content/uploads/2023/05/image-80.png" alt="" class="wp-image-34779" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-80.png 1090w, https://lycos7560.com/wp-content/uploads/2023/05/image-80-300x98.png 300w, https://lycos7560.com/wp-content/uploads/2023/05/image-80-768x250.png 768w" sizes="(max-width: 1090px) 100vw, 1090px" /></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<ul class="wp-block-list">
<li>그림의 파란색 선은 광고를 검토 중인 &#8220;죠르디&#8221; 동영상의 전체 재생 구간을 나타냅니다.
<ul class="wp-block-list">
<li>위 그림에서, &#8220;죠르디&#8221; 동영상의 총 재생시간은&nbsp;<code>02시간 03분 55초</code>&nbsp;입니다.</li>
</ul>
</li>



<li>그림의 검은색 선들은 각 시청자들이 &#8220;죠르디&#8221;의 동영상을 재생한 구간의 위치를 표시하고 있습니다.
<ul class="wp-block-list">
<li>검은색 선의 가운데 숫자는 각 재생 기록을 구분하는 ID를 나타냅니다.</li>



<li>검은색 선에 표기된 왼쪽 끝 숫자와 오른쪽 끝 숫자는 시청자들이 재생한 동영상 구간의 시작 시각과 종료 시각을 나타냅니다.</li>



<li>위 그림에서, 3번 재생 기록은 <code>00시 25분 50초</code> 부터 <code>00시 48분 29초</code> 까지 총 <code>00시간 22분 39초</code> 동안 죠르디의 동영상을 재생했습니다.</li>



<li>위 그림에서, 1번 재생 기록은&nbsp;<code>01시 20분 15초</code>&nbsp;부터&nbsp;<code>01시 45분 14초</code>&nbsp;까지 총&nbsp;<code>00시간 24분 59초</code>&nbsp;동안 죠르디의 동영상을 재생했습니다.</li>
</ul>
</li>



<li>그림의 빨간색 선은 &#8220;죠르디&#8221;가 선택한 최적의 공익광고 위치를 나타냅니다.
<ul class="wp-block-list">
<li>만약 공익광고의 재생시간이 <code>00시간 14분 15초</code>라면, 위의 그림처럼 <code>01시 30분 59초</code> 부터 <br><code>01시 45분 14초</code> 까지 공익광고를 삽입하는 것이 가장 좋습니다. 이 구간을 시청한 시청자들의 누적 재생시간이 가장 크기 때문입니다.</li>



<li><code>01시 30분 59초</code> 부터 <code>01시 45분 14초</code> 까지의 누적 재생시간은 다음과 같이 계산됩니다.
<ul class="wp-block-list">
<li><code>01시 30분 59초</code>&nbsp;부터&nbsp;<code>01시 37분 44초</code>&nbsp;까지 : 4번, 1번 재생 기록이 두차례 있으므로 재생시간의 합은&nbsp;<code>00시간 06분 45초</code>&nbsp;X 2 =&nbsp;<code>00시간 13분 30초</code></li>



<li><code>01시 37분 44초</code>&nbsp;부터&nbsp;<code>01시 45분 14초</code>&nbsp;까지 : 4번, 1번, 5번 재생 기록이 세차례 있으므로 재생시간의 합은&nbsp;<code>00시간 07분 30초</code>&nbsp;X 3 =&nbsp;<code>00시간 22분 30초</code></li>



<li>따라서, 이 구간 시청자들의 누적 재생시간은&nbsp;<code>00시간 13분 30초</code>&nbsp;+&nbsp;<code>00시간 22분 30초</code>&nbsp;=&nbsp;<code>00시간 36분 00초</code>입니다.</li>
</ul>
</li>
</ul>
</li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[문제]</strong></h2>



<p class="has-medium-font-size">&#8220;죠르디&#8221;의 동영상 재생시간 길이 play_time, 공익광고의 재생시간 길이 adv_time, </p>



<p class="has-medium-font-size">시청자들이 해당 동영상을 재생했던 구간 정보 logs가 매개변수로 주어질 때, </p>



<p class="has-medium-font-size">시청자들의 누적 재생시간이 가장 많이 나오는 곳에 공익광고를 삽입하려고 합니다. </p>



<p class="has-medium-font-size">이때, 공익광고가 들어갈 <code>시작 시각</code>을 구해서 return 하도록 solution 함수를 완성해주세요. </p>



<p class="has-medium-font-size">만약, 시청자들의 누적 재생시간이 가장 많은 곳이 여러 곳이라면, </p>



<p class="has-medium-font-size">그 중에서 <code>가장 빠른 시작 시각</code>을 return 하도록 합니다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[제한사항]</strong></h2>



<ul class="wp-block-list">
<li>play_time, adv_time은 길이 8로 고정된 문자열입니다.
<ul class="wp-block-list">
<li>play_time, adv_time은&nbsp;<code>HH:MM:SS</code>&nbsp;형식이며,&nbsp;<code>00:00:01</code>&nbsp;이상&nbsp;<code>99:59:59</code>&nbsp;이하입니다.</li>



<li>즉, 동영상 재생시간과 공익광고 재생시간은&nbsp;<code>00시간 00분 01초</code>&nbsp;이상&nbsp;<code>99시간 59분 59초</code>&nbsp;이하입니다.</li>



<li>공익광고 재생시간은 동영상 재생시간보다 짧거나 같게 주어집니다.</li>
</ul>
</li>



<li>logs는 크기가 1 이상 300,000 이하인 문자열 배열입니다.
<ul class="wp-block-list">
<li>logs 배열의 각 원소는 시청자의 재생 구간을 나타냅니다.</li>



<li>logs 배열의 각 원소는 길이가 17로 고정된 문자열입니다.</li>



<li>logs 배열의 각 원소는 <code>H1:M1:S1-H2:M2:S2</code> 형식입니다.
<ul class="wp-block-list">
<li><code>H1:M1:S1</code>은 동영상이 시작된 시각,&nbsp;<code>H2:M2:S2</code>는 동영상이 종료된 시각을 나타냅니다.</li>



<li><code>H1:M1:S1</code>는&nbsp;<code>H2:M2:S2</code>보다 1초 이상 이전 시각으로 주어집니다.</li>



<li><code>H1:M1:S1</code>와&nbsp;<code>H2:M2:S2</code>는 play_time 이내의 시각입니다.</li>
</ul>
</li>
</ul>
</li>



<li>시간을 나타내는 <code>HH, H1, H2</code>의 범위는 00~99, 분을 나타내는 <code>MM, M1, M2</code>의 범위는 00~59, <br>초를 나타내는 <code>SS, S1, S2</code>의 범위는 00~59까지 사용됩니다. <br>잘못된 시각은 입력으로 주어지지 않습니다. (예: <code>04:60:24</code>, <code>11:12:78</code>, <code>123:12:45</code> 등)</li>



<li>return 값의 형식
<ul class="wp-block-list">
<li>공익광고를 삽입할 시각을&nbsp;<code>HH:MM:SS</code>&nbsp;형식의 8자리 문자열로 반환합니다.</li>
</ul>
</li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>[입출력 예]</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">play_time</th><th class="has-text-align-left" data-align="left">adv_time</th><th class="has-text-align-left" data-align="left">logs</th><th class="has-text-align-left" data-align="left">result</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left"><code>"02:03:55"</code></td><td class="has-text-align-left" data-align="left"><code>"00:14:15"</code></td><td class="has-text-align-left" data-align="left"><code>["01:20:15-01:45:14", "00:40:31-01:00:00", "00:25:50-00:48:29", "01:30:59-01:53:29", "01:37:44-02:02:30"]</code></td><td class="has-text-align-left" data-align="left"><code>"01:30:59"</code></td></tr><tr><td class="has-text-align-left" data-align="left"><code>"99:59:59"</code></td><td class="has-text-align-left" data-align="left"><code>"25:00:00"</code></td><td class="has-text-align-left" data-align="left"><code>["69:59:59-89:59:59", "01:00:00-21:00:00", "79:59:59-99:59:59", "11:00:00-31:00:00"]</code></td><td class="has-text-align-left" data-align="left"><code>"01:00:00"</code></td></tr><tr><td class="has-text-align-left" data-align="left"><code>"50:00:00"</code></td><td class="has-text-align-left" data-align="left"><code>"50:00:00"</code></td><td class="has-text-align-left" data-align="left"><code>["15:36:51-38:21:49", "10:14:18-15:36:51", "38:21:49-42:51:45"]</code></td><td class="has-text-align-left" data-align="left"><code>"00:00:00"</code></td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>입출력 예에 대한 설명</strong></h2>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #1</strong></p>



<p>문제 예시와 같습니다.</p>



<p class="has-medium-font-size"><strong>입출력 예 #2</strong></p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1094" height="321" src="https://lycos7560.com/wp-content/uploads/2023/05/image-81.png" alt="" class="wp-image-34781" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-81.png 1094w, https://lycos7560.com/wp-content/uploads/2023/05/image-81-300x88.png 300w, https://lycos7560.com/wp-content/uploads/2023/05/image-81-768x225.png 768w" sizes="(max-width: 1094px) 100vw, 1094px" /></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><code>01:00:00</code>에 공익광고를 삽입하면 <code>26:00:00</code>까지 재생되며, 이곳이 가장 좋은 위치입니다. </p>



<p class="has-medium-font-size">이 구간의 시청자 누적 재생시간은 다음과 같습니다.</p>



<ul class="wp-block-list">
<li><code>01:00:00-11:00:00</code>&nbsp;: 해당 구간이 1회(2번 기록) 재생되었으므로 누적 재생시간은&nbsp;<code>10시간 00분 00초</code>&nbsp;입니다.</li>



<li><code>11:00:00-21:00:00</code>&nbsp;: 해당 구간이 2회(2번, 4번 기록) 재생되었으므로 누적 재생시간은&nbsp;<code>20시간 00분 00초</code>&nbsp;입니다.</li>



<li><code>21:00:00-26:00:00</code>&nbsp;: 해당 구간이 1회(4번 기록) 재생되었으므로 누적 재생시간은&nbsp;<code>05시간 00분 00초</code>&nbsp;입니다.</li>



<li>따라서, 이 구간의 시청자 누적 재생시간은&nbsp;<code>10시간 00분 00초</code>&nbsp;+&nbsp;<code>20시간 00분 00초</code>&nbsp;+&nbsp;<code>05시간 00분 00초</code>&nbsp;=&nbsp;<code>35시간 00분 00초</code>&nbsp;입니다.</li>



<li>초록색으로 표시된 구간(<code>69:59:59-94:59:59</code>)에 광고를 삽입해도 동일한 결과를 얻을 수 있으나,&nbsp;<code>01:00:00</code>이&nbsp;<code>69:59:59</code>&nbsp;보다 빠른 시각이므로,&nbsp;<code>"01:00:00"</code>을 return 합니다.</li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size"><strong>입출력 예 #</strong>3</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1096" height="323" src="https://lycos7560.com/wp-content/uploads/2023/05/image-82.png" alt="" class="wp-image-34782" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-82.png 1096w, https://lycos7560.com/wp-content/uploads/2023/05/image-82-300x88.png 300w, https://lycos7560.com/wp-content/uploads/2023/05/image-82-768x226.png 768w" sizes="(max-width: 1096px) 100vw, 1096px" /></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">동영상 재생시간과 공익광고 재생시간이 같으므로, </p>



<p class="has-medium-font-size">삽입할 수 있는 위치는 맨 처음(<code>00:00:00</code>)이 유일합니다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p><code>동영상 재생시간 = 재생이 종료된 시각 - 재생이 시작된 시각</code></p>



<p>(예를 들어, <code>00시 00분 01초</code>부터 <code>00시 00분 10초</code>까지 동영상이 재생되었다면, 동영상 재생시간은 <code>9초</code> 입니다.) </p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/05/KakaoTalk_20230514_223043316.jpg" alt="" class="wp-image-34788" width="1076" height="1440" srcset="https://lycos7560.com/wp-content/uploads/2023/05/KakaoTalk_20230514_223043316.jpg 1434w, https://lycos7560.com/wp-content/uploads/2023/05/KakaoTalk_20230514_223043316-224x300.jpg 224w, https://lycos7560.com/wp-content/uploads/2023/05/KakaoTalk_20230514_223043316-768x1028.jpg 768w, https://lycos7560.com/wp-content/uploads/2023/05/KakaoTalk_20230514_223043316-1147x1536.jpg 1147w" sizes="(max-width: 1076px) 100vw, 1076px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>주의</strong></h2>



<p class="has-medium-font-size">logs는 크기가 1 이상 300,000 이하인 문자열 배열</p>



<p class="has-medium-font-size">동영상 시간의 최대 범위는 360,000초</p>



<p class="has-medium-font-size">300,000 * 360,000 = 108,000,000,000</p>



<p class="has-medium-font-size">int의 범위 <strong>-2,147,483,648 ~ 2,147,483,647</strong>를 벗어난다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;sstream>
#include &lt;cstdlib>
#include &lt;string>

using namespace std;

int Total_PT_Int, Total_ADV_Time, TimeLine[360000];
long long int _Res;

vector&lt;pair&lt;int, int>> Logs_Times;

int StringTimeConverter(string time) {
    int second;

    int to_hour = ((time[0] - '0') * 10) + (time[1] - '0');
    int to_min = ((time[3] - '0') * 10) + (time[4] - '0');
    int to_sec = ((time[6] - '0') * 10) + (time[7] - '0');
    second = to_hour * 3600 + to_min * 60 + to_sec;

    return second;
}

string IntToTimeString(int timeInSeconds) {
    int hours = timeInSeconds / 3600;
    int minutes = (timeInSeconds % 3600) / 60;
    int seconds = (timeInSeconds % 3600) % 60;
    string str;
    if (hours &lt; 10) str += "0" + to_string(hours) + ":";
    else str += to_string(hours) + ":";
    if (minutes &lt; 10) str += "0" + to_string(minutes) + ":";
    else str += to_string(minutes) + ":";
    if (seconds &lt; 10) str += "0" + to_string(seconds);
    else str += to_string(seconds);
    return str;
}

string solution(string play_time, string adv_time, vector&lt;string> logs) {
    string answer = "";
    Total_PT_Int = StringTimeConverter(play_time);
    Total_ADV_Time = StringTimeConverter(adv_time);
    for (auto&amp; it : logs)
    {
        vector&lt;string> _ResV;
        istringstream ss(it);
        string _temp;
        while (getline(ss, _temp, '-'))
            _ResV.push_back(_temp);
        int _Start = StringTimeConverter(_ResV[0]);
        int _End = StringTimeConverter(_ResV[1]); 
        Logs_Times.push_back(make_pair(_Start, _End));
        TimeLine[_Start]++;
        TimeLine[_End]--;
    }

    for (int i = 1; i &lt; Total_PT_Int; i++) 
        TimeLine[i] += TimeLine[i - 1];

    // 0 부터 시작
    int STime = 0;
    for (int i = 1; i &lt; Total_ADV_Time; i++)
        _Res += TimeLine[i - 1];
    long long int Max = _Res;


    for (int i = Total_ADV_Time; i &lt; Total_PT_Int; i++) {
        _Res += TimeLine[i];
        _Res -= TimeLine[i - Total_ADV_Time];
        if (_Res > Max) {
            Max = _Res;
           STime = i - Total_ADV_Time + 1;
        }
    }
    return IntToTimeString(STime);
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/05/image-83.png" alt="" class="wp-image-34784" width="475" height="974" srcset="https://lycos7560.com/wp-content/uploads/2023/05/image-83.png 358w, https://lycos7560.com/wp-content/uploads/2023/05/image-83-146x300.png 146w" sizes="(max-width: 475px) 100vw, 475px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-72414-%ea%b4%91%ea%b3%a0-%ec%82%bd%ec%9e%85-2021-kakao-blind-recruitment/34776/">Programmers 72414 광고 삽입 [2021 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/programmers/programmers-72414-%ea%b4%91%ea%b3%a0-%ec%82%bd%ec%9e%85-2021-kakao-blind-recruitment/34776/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Programmers 42888 오픈채팅방 [2019 KAKAO BLIND RECRUITMENT]</title>
		<link>https://lycos7560.com/cpp/programmers/programmers-42888-%ec%98%a4%ed%94%88%ec%b1%84%ed%8c%85%eb%b0%a9-2019-kakao-blind-recruitment/34142/</link>
					<comments>https://lycos7560.com/cpp/programmers/programmers-42888-%ec%98%a4%ed%94%88%ec%b1%84%ed%8c%85%eb%b0%a9-2019-kakao-blind-recruitment/34142/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Mon, 20 Mar 2023 05:18:02 +0000</pubDate>
				<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[programmers]]></category>
		<category><![CDATA[[2019 KAKAO BLIND RECRUITMENT]]]></category>
		<category><![CDATA[2019 KAKAO BLIND RECRUITMENT]]></category>
		<category><![CDATA[42888]]></category>
		<category><![CDATA[42888번]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Programmers 42888]]></category>
		<category><![CDATA[Programmers 42888번]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[오픈채팅방]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[파싱(parsing)]]></category>
		<category><![CDATA[프로그래머스]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34142</guid>

					<description><![CDATA[<p>Programmers 42888번 '오픈채팅방' 문제에 대한 글입니다. [2019 KAKAO BLIND RECRUITMENT] (This article is about the 'Open Chat Room' problem in Programmers 42888. [2019 KAKAO BLIND RECRUITMENT])</p>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-42888-%ec%98%a4%ed%94%88%ec%b1%84%ed%8c%85%eb%b0%a9-2019-kakao-blind-recruitment/34142/">Programmers 42888 오픈채팅방 [2019 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-711c0f90      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#오픈채팅방" class="uagb-toc-link__trigger">오픈채팅방</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a><li class="uagb-toc__list"><a href="#더-효율적인-코드" class="uagb-toc-link__trigger">더 효율적인 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">오픈채팅방</h1>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/42888" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/42888</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">카카오톡 오픈채팅방에서는 친구가 아닌 사람들과 대화를 할 수 있는데, </p>



<p class="has-medium-font-size">본래 닉네임이 아닌 가상의 닉네임을 사용하여 채팅방에 들어갈 수 있다.</p>



<p class="has-medium-font-size">신입사원인 김크루는 카카오톡 오픈 채팅방을 개설한 사람을 위해, 다양한 사람들이 들어오고, </p>



<p class="has-medium-font-size">나가는 것을 지켜볼 수 있는 관리자창을 만들기로 했다. </p>



<p class="has-medium-font-size">채팅방에 누군가 들어오면 다음 메시지가 출력된다.</p>



<p class="has-medium-font-size">&#8220;[닉네임]님이 들어왔습니다.&#8221;</p>



<p class="has-medium-font-size">채팅방에서 누군가 나가면 다음 메시지가 출력된다.</p>



<p class="has-medium-font-size">&#8220;[닉네임]님이 나갔습니다.&#8221;</p>



<p class="has-medium-font-size">채팅방에서 닉네임을 변경하는 방법은 다음과 같이 두 가지이다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>채팅방을 나간 후, 새로운 닉네임으로 다시 들어간다.<br>채팅방에서 닉네임을 변경한다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">닉네임을 변경할 때는 기존에 채팅방에 출력되어 있던 메시지의 닉네임도 전부 변경된다.</p>



<p class="has-medium-font-size">예를 들어, 채팅방에 &#8220;Muzi&#8221;와 &#8220;Prodo&#8221;라는 닉네임을 사용하는 사람이 순서대로 들어오면 </p>



<p class="has-medium-font-size">채팅방에는 다음과 같이 메시지가 출력된다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>&#8220;Muzi님이 들어왔습니다.&#8221;<br>&#8220;Prodo님이 들어왔습니다.&#8221;</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">채팅방에 있던 사람이 나가면 채팅방에는 다음과 같이 메시지가 남는다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>&#8220;Muzi님이 들어왔습니다.&#8221;<br>&#8220;Prodo님이 들어왔습니다.&#8221;<br>&#8220;Muzi님이 나갔습니다.&#8221;</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">Muzi가 나간후 다시 들어올 때, Prodo 라는 닉네임으로 들어올 경우 </p>



<p class="has-medium-font-size">기존에 채팅방에 남아있던 Muzi도 Prodo로 다음과 같이 변경된다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>&#8220;Prodo님이 들어왔습니다.&#8221;<br>&#8220;Prodo님이 들어왔습니다.&#8221;<br>&#8220;Prodo님이 나갔습니다.&#8221;<br>&#8220;Prodo님이 들어왔습니다.&#8221;</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">채팅방은 중복 닉네임을 허용하기 때문에, 현재 채팅방에는 Prodo라는 닉네임을 사용하는 사람이 두 명이 있다. </p>



<p class="has-medium-font-size">이제, 채팅방에 두 번째로 들어왔던 Prodo가 Ryan으로 닉네임을 변경하면 채팅방 메시지는 다음과 같이 변경된다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>&#8220;Prodo님이 들어왔습니다.&#8221;<br>&#8220;Ryan님이 들어왔습니다.&#8221;<br>&#8220;Prodo님이 나갔습니다.&#8221;<br>&#8220;Prodo님이 들어왔습니다.&#8221;</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">채팅방에 들어오고 나가거나, 닉네임을 변경한 기록이 담긴 문자열 배열 record가 매개변수로 주어질 때, </p>



<p class="has-medium-font-size">모든 기록이 처리된 후, </p>



<p class="has-medium-font-size">최종적으로 방을 개설한 사람이 보게 되는 메시지를 문자열 배열 형태로 return 하도록 solution 함수를 완성하라.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h5 class="wp-block-heading has-large-font-size">제한사항</h5>



<ul class="wp-block-list">
<li>record는 다음과 같은 문자열이 담긴 배열이며, 길이는&nbsp;<code>1</code>&nbsp;이상&nbsp;<code>100,000</code>&nbsp;이하이다.</li>



<li>다음은 record에 담긴 문자열에 대한 설명이다.
<ul class="wp-block-list">
<li>모든 유저는 [유저 아이디]로 구분한다.</li>



<li>[유저 아이디] 사용자가 [닉네임]으로 채팅방에 입장 &#8211; &#8220;Enter [유저 아이디] [닉네임]&#8221; (ex. &#8220;Enter uid1234 Muzi&#8221;)</li>



<li>[유저 아이디] 사용자가 채팅방에서 퇴장 &#8211; &#8220;Leave [유저 아이디]&#8221; (ex. &#8220;Leave uid1234&#8221;)</li>



<li>[유저 아이디] 사용자가 닉네임을 [닉네임]으로 변경 &#8211; &#8220;Change [유저 아이디] [닉네임]&#8221; (ex. &#8220;Change uid1234 Muzi&#8221;)</li>



<li>첫 단어는 Enter, Leave, Change 중 하나이다.</li>



<li>각 단어는 공백으로 구분되어 있으며, 알파벳 대문자, 소문자, 숫자로만 이루어져있다.</li>



<li>유저 아이디와 닉네임은 알파벳 대문자, 소문자를 구별한다.</li>



<li>유저 아이디와 닉네임의 길이는&nbsp;<code>1</code>&nbsp;이상&nbsp;<code>10</code>&nbsp;이하이다.</li>



<li>채팅방에서 나간 유저가 닉네임을 변경하는 등 잘못 된 입력은 주어지지 않는다.</li>
</ul>
</li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h5 class="wp-block-heading">입출력 예</h5>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">record</th><th class="has-text-align-left" data-align="left">result</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left"><code>["Enter uid1234 Muzi", "Enter uid4567 Prodo","Leave uid1234","Enter uid1234 Prodo","Change uid4567 Ryan"]</code></td><td class="has-text-align-left" data-align="left"><code>["Prodo님이 들어왔습니다.", "Ryan님이 들어왔습니다.", "Prodo님이 나갔습니다.", "Prodo님이 들어왔습니다."]</code></td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h5 class="wp-block-heading">입출력 예 설명</h5>



<p class="has-medium-font-size">입출력 예 #1</p>



<p class="has-medium-font-size">문제의 설명과 같다.</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;sstream>
#include &lt;map>

using namespace std;

map&lt;string, string> userRegistMap;
multimap&lt;int , pair&lt;string, int>> dialogue;
string suffix[] = { "님이 들어왔습니다.", "님이 나갔습니다." };

vector&lt;string> solution(vector&lt;string> record) {
    vector&lt;string> answer;
	int diaCnt = 0;
	for (auto &amp;it : record) {
		string command, uid, nickname;
		int pivot = 0;
		for (int i = 0; i &lt; it.length(); i++) {
			if (it[i] != ' ') command.push_back(it[i]);		
			else {
				pivot = i + 1;
				break;
			}
		}

		for (int i = pivot; i &lt; it.length(); i++) {
			if (it[i] != ' ') uid.push_back(it[i]);			
			else {
				pivot = i + 1;
				break;
			}
		}

		if (command == "Enter" || command == "Change") {
			for (int i = pivot; i &lt; it.length(); i++) nickname.push_back(it[i]);
			auto it2 = userRegistMap.find(uid);
			if (command == "Enter") {
				if (it2 == userRegistMap.end()) userRegistMap.insert(make_pair(uid, nickname));			
				else it2->second = nickname;
				dialogue.insert(make_pair(diaCnt, make_pair(uid, 0)));
			}
			else it2->second = nickname;
		}
		else dialogue.insert(make_pair(diaCnt, make_pair(uid, 1)));
		diaCnt++;
	}

	for (auto &amp;it : dialogue) {
		string str;
		str.insert(0, userRegistMap.find(it.second.first)->second);
		str.insert(str.length(), suffix[it.second.second]);
		answer.push_back(str);
	}

    return answer;
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/03/image-66.png" alt="" class="wp-image-34154" width="631" height="1007" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-66.png 525w, https://lycos7560.com/wp-content/uploads/2023/03/image-66-188x300.png 188w" sizes="(max-width: 631px) 100vw, 631px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">더 효율적인 코드</h1>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/42888/solution_groups?language=cpp&amp;type=all" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/42888/solution_groups?language=cpp&amp;type=all</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;sstream>
#include &lt;iostream>
#include &lt;map>
using namespace std;


vector&lt;string> solution(vector&lt;string> record) {
    vector&lt;string> answer;
    string command;
    string ID;
    string uid;
   map&lt;string,string> m;


    for(string input:record)
    {
        stringstream ss(input);
        ss>>command;
        ss>>uid;
        if(command=="Enter" || command=="Change")
        {
            ss>>ID;
            m[uid]=ID;
        }
    }

   for(string input:record)
    {
        stringstream ss(input);
        ss>>command;
        ss>>uid;
        if(command=="Enter")
        {
         ID=(m.find(uid)->second);

            string temp = ID+"님이 들어왔습니다.";
         answer.push_back(temp);

        }
      else if(command=="Leave")
      {
         ID=(m.find(uid)->second);
            string temp = ID+"님이 나갔습니다.";
         answer.push_back(temp);
      }
    }
    return answer;
}
</pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-42888-%ec%98%a4%ed%94%88%ec%b1%84%ed%8c%85%eb%b0%a9-2019-kakao-blind-recruitment/34142/">Programmers 42888 오픈채팅방 [2019 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/programmers/programmers-42888-%ec%98%a4%ed%94%88%ec%b1%84%ed%8c%85%eb%b0%a9-2019-kakao-blind-recruitment/34142/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Programmers 17686 [3차] 파일명 정렬 [2018 KAKAO BLIND RECRUITMENT]</title>
		<link>https://lycos7560.com/cpp/programmers/programmers-17686-3%ec%b0%a8-%ed%8c%8c%ec%9d%bc%eb%aa%85-%ec%a0%95%eb%a0%ac-2018-kakao-blind-recruitment/34125/</link>
					<comments>https://lycos7560.com/cpp/programmers/programmers-17686-3%ec%b0%a8-%ed%8c%8c%ec%9d%bc%eb%aa%85-%ec%a0%95%eb%a0%ac-2018-kakao-blind-recruitment/34125/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sat, 18 Mar 2023 02:19:57 +0000</pubDate>
				<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[programmers]]></category>
		<category><![CDATA[[2018 KAKAO BLIND RECRUITMENT]]]></category>
		<category><![CDATA[[3차] 파일명 정렬]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[COMPARE]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Programmers 17686]]></category>
		<category><![CDATA[Programmers 17686번]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[파싱(parsing)]]></category>
		<category><![CDATA[파일명 정렬]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34125</guid>

					<description><![CDATA[<p>Programmers 17686번 '파일명 정렬' 문제에 대한 글입니다. (This article is about the problem of 'Sorting File Names' in Programmers 17686. [2018 KAKAO BLIND RECRUITMENT])</p>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-17686-3%ec%b0%a8-%ed%8c%8c%ec%9d%bc%eb%aa%85-%ec%a0%95%eb%a0%ac-2018-kakao-blind-recruitment/34125/">Programmers 17686 [3차] 파일명 정렬 [2018 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-6ebb29f8      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#파일명-정렬" class="uagb-toc-link__trigger">파일명 정렬</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">파일명 정렬</h1>



<p class="has-medium-font-size"><a href="https://school.programmers.co.kr/learn/courses/30/lessons/17686" target="_blank" rel="noreferrer noopener">https://school.programmers.co.kr/learn/courses/30/lessons/17686</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">세 차례의 코딩 테스트와 두 차례의 면접이라는 기나긴 블라인드 공채를 무사히 통과해 </p>



<p class="has-medium-font-size">카카오에 입사한 무지는 파일 저장소 서버 관리를 맡게 되었다.</p>



<p class="has-medium-font-size">저장소 서버에는 프로그램의 과거 버전을 모두 담고 있어, 이름 순으로 정렬된 파일 목록은 보기가 불편했다. </p>



<p class="has-medium-font-size">파일을 이름 순으로 정렬하면 나중에 만들어진 ver-10.zip이 ver-9.zip보다 먼저 표시되기 때문이다.</p>



<p class="has-medium-font-size">버전 번호 외에도 숫자가 포함된 파일 목록은 여러 면에서 관리하기 불편했다. </p>



<p class="has-medium-font-size">예컨대 파일 목록이 [&#8220;img12.png&#8221;, &#8220;img10.png&#8221;, &#8220;img2.png&#8221;, &#8220;img1.png&#8221;]일 경우, </p>



<p class="has-medium-font-size">일반적인 정렬은 [&#8220;img1.png&#8221;, &#8220;img10.png&#8221;, &#8220;img12.png&#8221;, &#8220;img2.png&#8221;] 순이 되지만, </p>



<p class="has-medium-font-size">숫자 순으로 정렬된 [&#8220;img1.png&#8221;, &#8220;img2.png&#8221;, &#8220;img10.png&#8221;, img12.png&#8221;] 순이 훨씬 자연스럽다.</p>



<p class="has-medium-font-size">무지는 단순한 문자 코드 순이 아닌, 파일명에 포함된 숫자를 반영한 정렬 기능을 저장소 관리 프로그램에 구현하기로 했다.</p>



<p class="has-medium-font-size">소스 파일 저장소에 저장된 파일명은 100 글자 이내로, </p>



<p class="has-medium-font-size">영문 대소문자, 숫자, 공백(&#8221; &#8220;), 마침표(&#8220;.&#8221;), 빼기 부호(&#8220;-&#8220;)만으로 이루어져 있다. </p>



<p class="has-medium-font-size">파일명은 영문자로 시작하며, 숫자를 하나 이상 포함하고 있다.</p>



<p class="has-medium-font-size">파일명은 크게 HEAD, NUMBER, TAIL의 세 부분으로 구성된다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">HEAD는 숫자가 아닌 문자로 이루어져 있으며, 최소한 한 글자 이상이다.</p>



<p class="has-medium-font-size">NUMBER는 한 글자에서 최대 다섯 글자 사이의 연속된 숫자로 이루어져 있으며, 앞쪽에 0이 올 수 있다.&nbsp;0부터&nbsp;99999&nbsp;사이의 숫자로,&nbsp;00000이나&nbsp;0101&nbsp;등도 가능하다.</p>



<p class="has-medium-font-size">TAIL은 그 나머지 부분으로, 여기에는 숫자가 다시 나타날 수도 있으며, 아무 글자도 없을 수 있다. </p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">파일명</th><th class="has-text-align-left" data-align="left">HEAD</th><th class="has-text-align-left" data-align="left">NUMBER</th><th class="has-text-align-left" data-align="left">TAIL</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left"><code>foo9.txt</code></td><td class="has-text-align-left" data-align="left"><code>foo</code></td><td class="has-text-align-left" data-align="left"><code>9</code></td><td class="has-text-align-left" data-align="left"><code>.txt</code></td></tr><tr><td class="has-text-align-left" data-align="left"><code>foo010bar020.zip</code></td><td class="has-text-align-left" data-align="left"><code>foo</code></td><td class="has-text-align-left" data-align="left"><code>010</code></td><td class="has-text-align-left" data-align="left"><code>bar020.zip</code></td></tr><tr><td class="has-text-align-left" data-align="left"><code>F-15</code></td><td class="has-text-align-left" data-align="left"><code>F-</code></td><td class="has-text-align-left" data-align="left"><code>15</code></td><td class="has-text-align-left" data-align="left">(빈 문자열)</td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">파일명을 세 부분으로 나눈 후, 다음 기준에 따라 파일명을 정렬한다.</p>



<ul class="wp-block-list">
<li>파일명은 우선 HEAD 부분을 기준으로 사전 순으로 정렬한다. 이때, 문자열 비교 시 대소문자 구분을 하지 않는다.&nbsp;<code>MUZI</code>와&nbsp;<code>muzi</code>,&nbsp;<code>MuZi</code>는 정렬 시에 같은 순서로 취급된다.</li>



<li>파일명의 HEAD 부분이 대소문자 차이 외에는 같을 경우, NUMBER의 숫자 순으로 정렬한다. 9 &lt; 10 &lt; 0011 &lt; 012 &lt; 13 &lt; 014 순으로 정렬된다. 숫자 앞의 0은 무시되며, 012와 12는 정렬 시에 같은 같은 값으로 처리된다.</li>



<li>두 파일의 HEAD 부분과, NUMBER의 숫자도 같을 경우, 원래 입력에 주어진 순서를 유지한다.&nbsp;<code>MUZI01.zip</code>과&nbsp;<code>muzi1.png</code>가 입력으로 들어오면, 정렬 후에도 입력 시 주어진 두 파일의 순서가 바뀌어서는 안 된다.</li>
</ul>



<p class="has-medium-font-size">무지를 도와 파일명 정렬 프로그램을 구현하라.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">입력 형식</h3>



<p class="has-medium-font-size">입력으로 배열&nbsp;<code>files</code>가 주어진다.</p>



<ul class="wp-block-list">
<li><code>files</code>는 1000 개 이하의 파일명을 포함하는 문자열 배열이다.</li>



<li>각 파일명은 100 글자 이하 길이로, 영문 대소문자, 숫자, 공백(&#8221; &#8220;), 마침표(&#8220;.&#8221;), 빼기 부호(&#8220;-&#8220;)만으로 이루어져 있다. 파일명은 영문자로 시작하며, 숫자를 하나 이상 포함하고 있다.</li>



<li>중복된 파일명은 없으나, 대소문자나 숫자 앞부분의 0 차이가 있는 경우는 함께 주어질 수 있다. (<code>muzi1.txt</code>,&nbsp;<code>MUZI1.txt</code>,&nbsp;<code>muzi001.txt</code>,&nbsp;<code>muzi1.TXT</code>는 함께 입력으로 주어질 수 있다.)</li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">출력 형식</h3>



<p class="has-medium-font-size">위 기준에 따라 정렬된 배열을 출력한다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">입출력 예제</h3>



<p class="has-medium-font-size">입력: [&#8220;img12.png&#8221;, &#8220;img10.png&#8221;, &#8220;img02.png&#8221;, &#8220;img1.png&#8221;, &#8220;IMG01.GIF&#8221;, &#8220;img2.JPG&#8221;]<br>출력: [&#8220;img1.png&#8221;, &#8220;IMG01.GIF&#8221;, &#8220;img02.png&#8221;, &#8220;img2.JPG&#8221;, &#8220;img10.png&#8221;, &#8220;img12.png&#8221;]</p>



<p class="has-medium-font-size">입력: [&#8220;F-5 Freedom Fighter&#8221;, &#8220;B-50 Superfortress&#8221;, &#8220;A-10 Thunderbolt II&#8221;, &#8220;F-14 Tomcat&#8221;]<br>출력: [&#8220;A-10 Thunderbolt II&#8221;, &#8220;B-50 Superfortress&#8221;, &#8220;F-5 Freedom Fighter&#8221;, &#8220;F-14 Tomcat&#8221;]</p>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<p class="has-medium-font-size">TAIL은 필요가 없다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;string>
#include &lt;vector>
#include &lt;tuple>
#include &lt;algorithm>

using namespace std;

vector&lt;tuple&lt;string, int, int>> sliceVector;
// 원본의 순서, Head, number, tail, originNum

bool cmp(tuple&lt;string, int, int> a, tuple&lt;string, int, int> b) {
	if (get&lt;0>(a) == get&lt;0>(b)) {
		if (get&lt;1>(a) == get&lt;1>(b)) {
			return get&lt;2>(a) &lt; get&lt;2>(b);
		}
		return get&lt;1>(a) &lt; get&lt;1>(b);
	}
	return get&lt;0>(a) &lt; get&lt;0>(b);
}

vector&lt;string> solution(vector&lt;string> files) {
	vector&lt;string> answer;

	int cnt = 0, number = 0;
	for (auto&amp; it : files) {
		string head = "", numStr = "";
		int pivot = 0;
		for (int i = 0; i &lt; it.length(); i++) {
			if (it[i] >= 48 &amp;&amp; it[i] &lt;= 57) {
				head = it.substr(pivot, i);
				for (auto&amp; ch : head) ch = toupper(ch); // 전부 대문자로 변환
				pivot = i;
				break;
			}
		}
		for (int i = 0; i &lt; 5; pivot++) {
			if (it[pivot] >= 48 &amp;&amp; it[pivot] &lt;= 57) {
				numStr.push_back(it[pivot]);
				continue;
			}
			number = atoi(numStr.c_str());
			break;
		}

		sliceVector.push_back(make_tuple(head, number, cnt));
		cnt++;
	}

	sort(sliceVector.begin(), sliceVector.end(), cmp);
	for (auto&amp; it : sliceVector) answer.push_back(files[get&lt;2>(it)]);
	
	return answer;
}</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="466" height="599" src="https://lycos7560.com/wp-content/uploads/2023/03/image-63.png" alt="" class="wp-image-34127" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-63.png 466w, https://lycos7560.com/wp-content/uploads/2023/03/image-63-233x300.png 233w" sizes="(max-width: 466px) 100vw, 466px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/programmers/programmers-17686-3%ec%b0%a8-%ed%8c%8c%ec%9d%bc%eb%aa%85-%ec%a0%95%eb%a0%ac-2018-kakao-blind-recruitment/34125/">Programmers 17686 [3차] 파일명 정렬 [2018 KAKAO BLIND RECRUITMENT]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/programmers/programmers-17686-3%ec%b0%a8-%ed%8c%8c%ec%9d%bc%eb%aa%85-%ec%a0%95%eb%a0%ac-2018-kakao-blind-recruitment/34125/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 1541번 (잃어버린 괄호, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-1541%eb%b2%88-%ec%9e%83%ec%96%b4%eb%b2%84%eb%a6%b0-%ea%b4%84%ed%98%b8-c-baekjoon/5649/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-1541%eb%b2%88-%ec%9e%83%ec%96%b4%eb%b2%84%eb%a6%b0-%ea%b4%84%ed%98%b8-c-baekjoon/5649/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 27 Jan 2023 09:57:23 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[atoi]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cin]]></category>
		<category><![CDATA[cin.tie(NULL)]]></category>
		<category><![CDATA[cout]]></category>
		<category><![CDATA[cout.tie(NULL)]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Greedy]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false)]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false);]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[그리디]]></category>
		<category><![CDATA[그리디 알고리즘]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 1541]]></category>
		<category><![CDATA[백준 1541번]]></category>
		<category><![CDATA[수학]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=5649</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 1541번 '잃어버린 괄호' 문제에 대한 글입니다. (This is an article on the question of 'Lost Parentheses' in BAEKJOON No. 1541.) </p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-1541%eb%b2%88-%ec%9e%83%ec%96%b4%eb%b2%84%eb%a6%b0-%ea%b4%84%ed%98%b8-c-baekjoon/5649/">백준 1541번 (잃어버린 괄호, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">잃어버린 괄호</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/1541" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/1541</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure id="problem-info" class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">시간 제한</th><th class="has-text-align-left" data-align="left">메모리 제한</th><th class="has-text-align-left" data-align="left">제출</th><th class="has-text-align-left" data-align="left">정답</th><th class="has-text-align-left" data-align="left">맞힌 사람</th><th class="has-text-align-left" data-align="left">정답 비율</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">2 초</td><td class="has-text-align-left" data-align="left">128 MB</td><td class="has-text-align-left" data-align="left">60829</td><td class="has-text-align-left" data-align="left">31765</td><td class="has-text-align-left" data-align="left">25201</td><td class="has-text-align-left" data-align="left">51.706%</td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제</h2>



<p class="has-medium-font-size">세준이는 양수와 +, -, 그리고 괄호를 가지고 식을 만들었다. </p>



<p class="has-medium-font-size">그리고 나서 세준이는 괄호를 모두 지웠다.</p>



<p class="has-medium-font-size">그리고 나서 세준이는 괄호를 적절히 쳐서 이 식의 값을 최소로 만들려고 한다.</p>



<p class="has-medium-font-size">괄호를 적절히 쳐서 이 식의 값을 최소로 만드는 프로그램을 작성하시오.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">입력</h2>



<p class="has-medium-font-size">첫째 줄에 식이 주어진다. 식은 ‘0’~‘9’, ‘+’, 그리고 ‘-’만으로 이루어져 있고, 가장 처음과 마지막 문자는 숫자이다. </p>



<p class="has-medium-font-size">그리고 연속해서 두 개 이상의 연산자가 나타나지 않고, 5자리보다 많이 연속되는 숫자는 없다. </p>



<p class="has-medium-font-size">수는 0으로 시작할 수 있다. 입력으로 주어지는 식의 길이는 50보다 작거나 같다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출력</h2>



<p class="has-medium-font-size">첫째 줄에 정답을 출력한다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">55-50+40</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">-35</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 2</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">10+20+30+40</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 2</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">100</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 3</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">00009-00009</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 3</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">0</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출처</h2>



<ul class="wp-block-list">
<li>문제를 번역한 사람: <a href="https://www.acmicpc.net/user/baekjoon" target="_blank" rel="noreferrer noopener">baekjoon</a></li>



<li>잘못된 조건을 찾은 사람: <a href="https://www.acmicpc.net/user/windflower" target="_blank" rel="noreferrer noopener">windflower</a></li>
</ul>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">알고리즘 분류</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/124">수학</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/158">문자열</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/33" target="_blank" rel="noreferrer noopener">그리디 알고리즘</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/96">파싱</a></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<figure class="wp-block-image size-full"><img decoding="async" width="1600" height="1126" src="https://lycos7560.com/wp-content/uploads/2023/01/KakaoTalk_20230127_184748740.jpg" alt="" class="wp-image-5651" srcset="https://lycos7560.com/wp-content/uploads/2023/01/KakaoTalk_20230127_184748740.jpg 1600w, https://lycos7560.com/wp-content/uploads/2023/01/KakaoTalk_20230127_184748740-300x211.jpg 300w, https://lycos7560.com/wp-content/uploads/2023/01/KakaoTalk_20230127_184748740-768x540.jpg 768w, https://lycos7560.com/wp-content/uploads/2023/01/KakaoTalk_20230127_184748740-1536x1081.jpg 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">통과된 코드</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;cmath>

using namespace std;

string str, tempStr;

int result = 0;
bool check = false;

int main()
{
	ios_base::sync_with_stdio(false); // scanf와 동기화를 비활성화
	// cin.tie(null); 코드는 cin과 cout의 묶음을 풀어줍니다.
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> str;

	// 한번이라도 - 가 나온다면 뒤의 수들은 전부 뺴준다.
	for (int i = 0; i &lt; str.length(); i++) {
		if (str[i] == 45) { // '-' = 45
			result += atoi(tempStr.c_str()) * ( pow(-1, check));
			check = true;
			tempStr = "";
		}
		else if (str[i] == 43) { // '+' = 43
			result += atoi(tempStr.c_str()) * (pow(-1, check));
			tempStr = "";
		}
		else tempStr.push_back(str[i]);
	}

	// 마지막 숫자 해결
	result += atoi(tempStr.c_str()) * (pow(-1, check));

	cout &lt;&lt; result;

	return 0;
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1036" height="103" src="https://lycos7560.com/wp-content/uploads/2023/01/image-25.png" alt="" class="wp-image-5652" srcset="https://lycos7560.com/wp-content/uploads/2023/01/image-25.png 1036w, https://lycos7560.com/wp-content/uploads/2023/01/image-25-300x30.png 300w, https://lycos7560.com/wp-content/uploads/2023/01/image-25-768x76.png 768w" sizes="(max-width: 1036px) 100vw, 1036px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-1541%eb%b2%88-%ec%9e%83%ec%96%b4%eb%b2%84%eb%a6%b0-%ea%b4%84%ed%98%b8-c-baekjoon/5649/">백준 1541번 (잃어버린 괄호, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-1541%eb%b2%88-%ec%9e%83%ec%96%b4%eb%b2%84%eb%a6%b0-%ea%b4%84%ed%98%b8-c-baekjoon/5649/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 10823번 (더하기 2, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10823%eb%b2%88-%eb%8d%94%ed%95%98%ea%b8%b0-2-c-baekjoon/34066/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10823%eb%b2%88-%eb%8d%94%ed%95%98%ea%b8%b0-2-c-baekjoon/34066/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 15 Jan 2023 21:45:41 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10823]]></category>
		<category><![CDATA[10823번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[더하기 2]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10823]]></category>
		<category><![CDATA[백준 10823번]]></category>
		<category><![CDATA[사칙연산]]></category>
		<category><![CDATA[수학]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<category><![CDATA[파싱(parsing)]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=34066</guid>

					<description><![CDATA[<p>백준 10823번 '더하기 2' 문제에 대한 글입니다. 파싱 기초 문제입니다. (This is an article on the question of 'plus 2' of Baekjun 10823. It's a parsing basic problem.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10823%eb%b2%88-%eb%8d%94%ed%95%98%ea%b8%b0-2-c-baekjoon/34066/">백준 10823번 (더하기 2, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-77132237      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#더하기-2" class="uagb-toc-link__trigger">더하기 2</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">더하기 2</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/10823" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/10823</a></p>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<figure id="problem-info" class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">시간 제한</th><th class="has-text-align-left" data-align="left">메모리 제한</th><th class="has-text-align-left" data-align="left">제출</th><th class="has-text-align-left" data-align="left">정답</th><th class="has-text-align-left" data-align="left">맞힌 사람</th><th class="has-text-align-left" data-align="left">정답 비율</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">1 초</td><td class="has-text-align-left" data-align="left">256 MB</td><td class="has-text-align-left" data-align="left">3518</td><td class="has-text-align-left" data-align="left">1917</td><td class="has-text-align-left" data-align="left">1642</td><td class="has-text-align-left" data-align="left">57.093%</td></tr></tbody></table></figure>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제</h2>



<p class="has-medium-font-size">숫자와 콤마로만 이루어진 문자열 S가 주어진다. </p>



<p class="has-medium-font-size">이때, S에 포함되어있는 자연수의 합을 구하는 프로그램을 작성하시오.</p>



<p class="has-medium-font-size">S의 첫 문자와 마지막 문자는 항상 숫자이고, 콤마는 연속해서 주어지지 않는다. 주어지는 수는 항상 자연수이다.</p>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">입력</h2>



<p class="has-medium-font-size">문자열 S가 여러 줄에 걸쳐서 주어진다. </p>



<p class="has-medium-font-size">S의 길이는 최대 10,000이다. </p>



<p class="has-medium-font-size">포함되어있는 정수는 1,000,000보다 작거나 같은 자연수이다.</p>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출력</h2>



<p class="has-medium-font-size">문자열 S에 포함되어 있는 자연수의 합을 출력한다.</p>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">10,20,
3
0,50
,1
00</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">210</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출처</h2>



<ul class="wp-block-list">
<li>문제를 만든 사람:&nbsp;<a href="https://www.acmicpc.net/user/baekjoon" target="_blank" rel="noreferrer noopener">baekjoon</a></li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">알고리즘 분류</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/124" target="_blank" rel="noreferrer noopener">수학</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/158" target="_blank" rel="noreferrer noopener">문자열</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/121" target="_blank" rel="noreferrer noopener">사칙연산</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/96" target="_blank" rel="noreferrer noopener">파싱</a></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="has-large-font-size wp-block-heading">통과된 코드</h1>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;string>
#include &lt;cstdlib>

using namespace std;

int result = 0;
string str, temp;

int main()
{
    ios_base::sync_with_stdio(false); // scanf와 동기화를 비활성화
    // cin.tie(null); 코드는 cin과 cout의 묶음을 풀어줍니다.
    cin.tie(NULL);
    cout.tie(NULL);

    while (getline(cin, str)) {
        for (int i = 0; i &lt; str.length(); i++) {
            if (str[i] >= 48 &amp;&amp; str[i] &lt;= 57) { // 0 ~ 9
                temp.push_back(str[i]);
            }
            else {
                result += atoi(temp.c_str());
                temp.clear();
            }
        }
    }

    result += atoi(temp.c_str());

    cout &lt;&lt; result;

    return 0;
}</pre>



<div style="height:86px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/03/image-59.png" alt="" class="wp-image-34067" width="1029" height="186" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-59.png 1036w, https://lycos7560.com/wp-content/uploads/2023/03/image-59-300x54.png 300w, https://lycos7560.com/wp-content/uploads/2023/03/image-59-768x139.png 768w" sizes="(max-width: 1029px) 100vw, 1029px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10823%eb%b2%88-%eb%8d%94%ed%95%98%ea%b8%b0-2-c-baekjoon/34066/">백준 10823번 (더하기 2, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10823%eb%b2%88-%eb%8d%94%ed%95%98%ea%b8%b0-2-c-baekjoon/34066/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 10821번 (정수의 개수, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10821%eb%b2%88-%ec%a0%95%ec%88%98%ec%9d%98-%ea%b0%9c%ec%88%98-c-baekjoon/33928/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10821%eb%b2%88-%ec%a0%95%ec%88%98%ec%9d%98-%ea%b0%9c%ec%88%98-c-baekjoon/33928/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 13 Jan 2023 00:20:27 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10821]]></category>
		<category><![CDATA[10821번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10821]]></category>
		<category><![CDATA[백준 10821번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[정수의 개수]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=33928</guid>

					<description><![CDATA[<p>백준 10821번 '정수의 개수' 문제에 대한 글입니다. (This is an article on the question of 'number of integers' in Baekjoon 10821. )</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10821%eb%b2%88-%ec%a0%95%ec%88%98%ec%9d%98-%ea%b0%9c%ec%88%98-c-baekjoon/33928/">백준 10821번 (정수의 개수, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-6f467419      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#정수의-개수" class="uagb-toc-link__trigger">정수의 개수</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">정수의 개수</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/10821" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/10821</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure id="problem-info" class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">시간 제한</th><th class="has-text-align-left" data-align="left">메모리 제한</th><th class="has-text-align-left" data-align="left">제출</th><th class="has-text-align-left" data-align="left">정답</th><th class="has-text-align-left" data-align="left">맞힌 사람</th><th class="has-text-align-left" data-align="left">정답 비율</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">1 초</td><td class="has-text-align-left" data-align="left">256 MB</td><td class="has-text-align-left" data-align="left">5540</td><td class="has-text-align-left" data-align="left">4624</td><td class="has-text-align-left" data-align="left">4240</td><td class="has-text-align-left" data-align="left">84.648%</td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제</h2>



<p class="has-medium-font-size">숫자와 콤마로만 이루어진 문자열 S가 주어진다. </p>



<p class="has-medium-font-size">이때, S에 포함되어있는 정수의 개수를 구하는 프로그램을 작성하시오.</p>



<p class="has-medium-font-size">S의 첫 문자와 마지막 문자는 항상 숫자이고, 콤마는 연속해서 주어지지 않는다. </p>



<p class="has-medium-font-size">또, 0으로 시작하는 정수는 주어지지 않는다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">입력</h2>



<p class="has-medium-font-size">첫째 줄에 문자열 S가 주어진다. </p>



<p class="has-medium-font-size">S의 길이는 최대 100이다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출력</h2>



<p class="has-medium-font-size">문자열 S에 포함되어 있는 정수의 개수를 출력한다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">10,20,30,50,100</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">5</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출처</h2>



<ul class="wp-block-list">
<li>문제를 만든 사람: <a href="https://www.acmicpc.net/user/baekjoon">baekjoo</a><a href="https://www.acmicpc.net/user/baekjoon" target="_blank" rel="noreferrer noopener">n</a></li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">알고리즘 분류</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/158" target="_blank" rel="noreferrer noopener">문자열</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/96" target="_blank" rel="noreferrer noopener">파싱</a></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;cstdlib>

using namespace std;

int res;
string str;

int main()
{
    cin >> str;
    for (int i = 0; i &lt; str.length(); i++)
        if (str[i] == ',') res++;
    cout &lt;&lt; res + 1;

    return 0;
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/03/image-48.png" alt="" class="wp-image-33930" width="1107" height="102" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-48.png 1033w, https://lycos7560.com/wp-content/uploads/2023/03/image-48-300x28.png 300w, https://lycos7560.com/wp-content/uploads/2023/03/image-48-768x71.png 768w" sizes="(max-width: 1107px) 100vw, 1107px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10821%eb%b2%88-%ec%a0%95%ec%88%98%ec%9d%98-%ea%b0%9c%ec%88%98-c-baekjoon/33928/">백준 10821번 (정수의 개수, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10821%eb%b2%88-%ec%a0%95%ec%88%98%ec%9d%98-%ea%b0%9c%ec%88%98-c-baekjoon/33928/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 10953번 (A+B &#8211; 6, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10953%eb%b2%88-ab-6-c-baekjoon/33922/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10953%eb%b2%88-ab-6-c-baekjoon/33922/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 13 Jan 2023 00:07:11 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10953]]></category>
		<category><![CDATA[10953번]]></category>
		<category><![CDATA[A+B - 6]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[cstdlib]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10953]]></category>
		<category><![CDATA[백준 10953번]]></category>
		<category><![CDATA[수학]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=33922</guid>

					<description><![CDATA[<p>백준 10953번 'A+B - 6' 문제에 대한 글입니다. (This is an article on the question of 'A+B-6' in Baekjoon 10953.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10953%eb%b2%88-ab-6-c-baekjoon/33922/">백준 10953번 (A+B &#8211; 6, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-c7696bb7      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#ab-6" class="uagb-toc-link__trigger">A+B &#8211; 6</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">A+B &#8211; 6</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/10953" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/10953</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure id="problem-info" class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">시간 제한</th><th class="has-text-align-left" data-align="left">메모리 제한</th><th class="has-text-align-left" data-align="left">제출</th><th class="has-text-align-left" data-align="left">정답</th><th class="has-text-align-left" data-align="left">맞힌 사람</th><th class="has-text-align-left" data-align="left">정답 비율</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">1 초</td><td class="has-text-align-left" data-align="left">256 MB</td><td class="has-text-align-left" data-align="left">37355</td><td class="has-text-align-left" data-align="left">24991</td><td class="has-text-align-left" data-align="left">22007</td><td class="has-text-align-left" data-align="left">68.053%</td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제</h2>



<p class="has-medium-font-size">두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">입력</h2>



<p class="has-medium-font-size">첫째 줄에 테스트 케이스의 개수 T가 주어진다.</p>



<p class="has-medium-font-size">각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. </p>



<p class="has-medium-font-size">A와 B는 콤마(,)로 구분되어 있다. (0 &lt; A, B &lt; 10)</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출력</h2>



<p class="has-medium-font-size">각 테스트 케이스마다 A+B를 출력한다.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">5
1,1
2,3
3,4
9,8
5,2</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">2
5
7
17
7</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출처</h2>



<ul class="wp-block-list">
<li>문제를 만든 사람: <a href="https://www.acmicpc.net/user/baekjoon" target="_blank" rel="noreferrer noopener">baekjoon</a></li>



<li>빠진 조건을 찾은 사람: <a href="https://www.acmicpc.net/user/djm03178" target="_blank" rel="noreferrer noopener">djm03178</a></li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">비슷한 문제</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/1000" target="_blank" rel="noreferrer noopener">1000번. A+B</a></li>



<li><a href="https://www.acmicpc.net/problem/1001" target="_blank" rel="noreferrer noopener">1001번. A-B</a></li>



<li><a href="https://www.acmicpc.net/problem/1008" target="_blank" rel="noreferrer noopener">1008번. A/B</a></li>



<li><a href="https://www.acmicpc.net/problem/2558" target="_blank" rel="noreferrer noopener">2558번. A+B &#8211; 2</a></li>



<li><a href="https://www.acmicpc.net/problem/10950" target="_blank" rel="noreferrer noopener">10950번. A+B &#8211; 3</a></li>



<li><a href="https://www.acmicpc.net/problem/10951" target="_blank" rel="noreferrer noopener">10951번. A+B &#8211; 4</a></li>



<li><a href="https://www.acmicpc.net/problem/10952" target="_blank" rel="noreferrer noopener">10952번. A+B &#8211; 5</a></li>



<li><a href="https://www.acmicpc.net/problem/10998" target="_blank" rel="noreferrer noopener">10998번. A×B</a></li>



<li><a href="https://www.acmicpc.net/problem/11021" target="_blank" rel="noreferrer noopener">11021번. A+B &#8211; 7</a></li>



<li><a href="https://www.acmicpc.net/problem/11022" target="_blank" rel="noreferrer noopener">11022번. A+B &#8211; 8</a></li>



<li><a href="https://www.acmicpc.net/problem/15740" target="_blank" rel="noreferrer noopener">15740번. A+B &#8211; 9</a></li>



<li><a href="https://www.acmicpc.net/problem/15792" target="_blank" rel="noreferrer noopener">15792번. A/B &#8211; 2</a></li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">알고리즘 분류</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/124">수</a><a href="https://www.acmicpc.net/problem/tag/124" target="_blank" rel="noreferrer noopener">학</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/158" target="_blank" rel="noreferrer noopener">문자열</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/121" target="_blank" rel="noreferrer noopener">사칙연산</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/96" target="_blank" rel="noreferrer noopener">파싱</a></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;cstdlib>

using namespace std;

int N, A, B;
string str;

int main()
{
    ios_base::sync_with_stdio(false); // scanf와 동기화를 비활성화
    // cin.tie(null); 코드는 cin과 cout의 묶음을 풀어줍니다.
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N;
    for (int i = 0; i &lt; N; i++) {
        cin >> str;
        A = atoi(str.substr(0, 1).c_str());
        B = atoi(str.substr(2, 1).c_str());    
        cout &lt;&lt; A + B &lt;&lt; "\n";
    }

    return 0;
}</pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/03/image-47.png" alt="" class="wp-image-33925" width="1256" height="125" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-47.png 1037w, https://lycos7560.com/wp-content/uploads/2023/03/image-47-300x30.png 300w, https://lycos7560.com/wp-content/uploads/2023/03/image-47-768x76.png 768w" sizes="(max-width: 1256px) 100vw, 1256px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10953%eb%b2%88-ab-6-c-baekjoon/33922/">백준 10953번 (A+B &#8211; 6, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10953%eb%b2%88-ab-6-c-baekjoon/33922/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 26068번 (치킨댄스를 추는 곰곰이를 본 임스 2, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-26068%eb%b2%88-%ec%b9%98%ed%82%a8%eb%8c%84%ec%8a%a4%eb%a5%bc-%ec%b6%94%eb%8a%94-%ea%b3%b0%ea%b3%b0%ec%9d%b4%eb%a5%bc-%eb%b3%b8-%ec%9e%84%ec%8a%a4-2-c-baekjoon/33944/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-26068%eb%b2%88-%ec%b9%98%ed%82%a8%eb%8c%84%ec%8a%a4%eb%a5%bc-%ec%b6%94%eb%8a%94-%ea%b3%b0%ea%b3%b0%ec%9d%b4%eb%a5%bc-%eb%b3%b8-%ec%9e%84%ec%8a%a4-2-c-baekjoon/33944/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 13 Dec 2022 21:21:41 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[26068]]></category>
		<category><![CDATA[26068번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[cstdlib]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구현]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 26068]]></category>
		<category><![CDATA[백준 26068번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[치킨댄스를 추는 곰곰이를 본 임스 2]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[파싱]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=33944</guid>

					<description><![CDATA[<p>치킨댄스를 추는 곰곰이를 본 임스 2 https://www.acmicpc.net/problem/26068 시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율 1 초 1024 MB 1732 1262 1130 76.455% 문제 마음씨 착한 곰곰이는 임스에게 치킨 기프티콘을 여러 번 선물했다. 기프티콘이 있다는 사실을 잊고 있던 임스는 치킨 댄스를 추는 곰곰이를 보고 그 사실이 생각났다. 치킨 기프티콘을 선물받은 횟수 N과 선물의 남은 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-26068%eb%b2%88-%ec%b9%98%ed%82%a8%eb%8c%84%ec%8a%a4%eb%a5%bc-%ec%b6%94%eb%8a%94-%ea%b3%b0%ea%b3%b0%ec%9d%b4%eb%a5%bc-%eb%b3%b8-%ec%9e%84%ec%8a%a4-2-c-baekjoon/33944/">백준 26068번 (치킨댄스를 추는 곰곰이를 본 임스 2, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-11144e06      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#치킨댄스를-추는-곰곰이를-본-임스-2" class="uagb-toc-link__trigger">치킨댄스를 추는 곰곰이를 본 임스 2</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


<div style="height:62px" aria-hidden="true" class="wp-block-spacer"></div>



<h1 class="wp-block-heading">치킨댄스를 추는 곰곰이를 본 임스 2</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/26068" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/26068</a></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<figure id="problem-info" class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-left" data-align="left">시간 제한</th><th class="has-text-align-left" data-align="left">메모리 제한</th><th class="has-text-align-left" data-align="left">제출</th><th class="has-text-align-left" data-align="left">정답</th><th class="has-text-align-left" data-align="left">맞힌 사람</th><th class="has-text-align-left" data-align="left">정답 비율</th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left">1 초</td><td class="has-text-align-left" data-align="left">1024 MB</td><td class="has-text-align-left" data-align="left">1732</td><td class="has-text-align-left" data-align="left">1262</td><td class="has-text-align-left" data-align="left">1130</td><td class="has-text-align-left" data-align="left">76.455%</td></tr></tbody></table></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">문제</h2>



<p class="has-medium-font-size">마음씨 착한 곰곰이는 임스에게 치킨 기프티콘을 여러 번 선물했다.</p>



<p class="has-medium-font-size">기프티콘이 있다는 사실을 잊고 있던 임스는 치킨 댄스를 추는 곰곰이를 보고 그 사실이 생각났다.</p>



<p class="has-medium-font-size">치킨 기프티콘을 선물받은 횟수 N과 선물의 남은 유효기간이 주어질 때, 임스가 사용할 기프티콘의 개수를 구하시오.</p>



<p class="has-medium-font-size">임스는 기프티콘을 아껴 사용하기 위해 유효기간이&nbsp;<strong>90일 이하</strong>로 남은 기프티콘만 사용할 것이다.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="376" height="241" src="https://lycos7560.com/wp-content/uploads/2023/03/image-50.png" alt="" class="wp-image-33945" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-50.png 376w, https://lycos7560.com/wp-content/uploads/2023/03/image-50-300x192.png 300w" sizes="(max-width: 376px) 100vw, 376px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">입력</h2>



<p class="has-medium-font-size">첫 번째 줄에는 임스가 받은 기프티콘의 개수 정수 N이 주어진다. (1≤N≤1000)</p>



<p class="has-medium-font-size">두 번째 줄부터 N개의 줄에 걸쳐 i번째 기프티콘의 남은 유효기간 x_i 가 <code>D-x<sub>i</sub></code> 와 같은 형식으로 주어진다. (1≤ x_i ≤365)</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출력</h2>



<p class="has-medium-font-size">임스가 사용할 기프티콘의 개수를 출력하시오.</p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">3
D-86
D-8
D-6</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 1</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">3</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 입력 2</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">4
D-98
D-5
D-94
D-2</pre>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">예제 출력 2</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">2</pre>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">출처</h2>



<p><a href="https://www.acmicpc.net/category/45" target="_blank" rel="noreferrer noopener">Contest</a> > <a href="https://www.acmicpc.net/category/663" target="_blank" rel="noreferrer noopener">곰곰컵</a> > <a href="https://www.acmicpc.net/category/detail/3232" target="_blank" rel="noreferrer noopener">제2회 곰곰컵</a> A번</p>



<ul class="wp-block-list">
<li>문제를 검수한 사람: <a href="https://www.acmicpc.net/user/bnb2011" target="_blank" rel="noreferrer noopener">bnb2011</a>, <a href="https://www.acmicpc.net/user/chogahui05" target="_blank" rel="noreferrer noopener">chogahui05</a>, <a href="https://www.acmicpc.net/user/jthis" target="_blank" rel="noreferrer noopener">jthis</a>, <a href="https://www.acmicpc.net/user/jyheo98" target="_blank" rel="noreferrer noopener">jyheo98</a>, <a href="https://www.acmicpc.net/user/pichulia" target="_blank" rel="noreferrer noopener">pichulia</a>, <a href="https://www.acmicpc.net/user/pjshwa" target="_blank" rel="noreferrer noopener">pjshwa</a>, <a href="https://www.acmicpc.net/user/r4pidstart" target="_blank" rel="noreferrer noopener">r4pidstart</a>, <a href="https://www.acmicpc.net/user/tony9402" target="_blank" rel="noreferrer noopener">tony9402</a></li>



<li>문제를 만든 사람: <a href="https://www.acmicpc.net/user/lms0806" target="_blank" rel="noreferrer noopener">lms0806</a></li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">알고리즘 분류</h2>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/102">구</a><a href="https://www.acmicpc.net/problem/tag/102" target="_blank" rel="noreferrer noopener">현</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/158" target="_blank" rel="noreferrer noopener">문자열</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/96" target="_blank" rel="noreferrer noopener">파싱</a></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:var(--wp--preset--spacing--80);margin-bottom:var(--wp--preset--spacing--80)"/>



<h1 class="has-large-font-size wp-block-heading">통과된 코드</h1>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="cpp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">#include &lt;iostream>
#include &lt;string>
#include &lt;cstdlib>

using namespace std;

int N, temp, res;
string str;

int main()
{
	cin >> N;
	for (int i = 0; i &lt; N; i++) {
		cin >> str;
		temp = atoi(str.substr(2, str.length() - 2).c_str());
		if (temp &lt;= 90)  res++;
	}

	cout &lt;&lt; res;

	return 0;
}</pre>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size">90을 미포함해서 틀렸다.</p>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/2023/03/image-51.png" alt="" class="wp-image-33946" width="1165" height="160" srcset="https://lycos7560.com/wp-content/uploads/2023/03/image-51.png 1032w, https://lycos7560.com/wp-content/uploads/2023/03/image-51-300x41.png 300w, https://lycos7560.com/wp-content/uploads/2023/03/image-51-768x106.png 768w" sizes="(max-width: 1165px) 100vw, 1165px" /></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-26068%eb%b2%88-%ec%b9%98%ed%82%a8%eb%8c%84%ec%8a%a4%eb%a5%bc-%ec%b6%94%eb%8a%94-%ea%b3%b0%ea%b3%b0%ec%9d%b4%eb%a5%bc-%eb%b3%b8-%ec%9e%84%ec%8a%a4-2-c-baekjoon/33944/">백준 26068번 (치킨댄스를 추는 곰곰이를 본 임스 2, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-26068%eb%b2%88-%ec%b9%98%ed%82%a8%eb%8c%84%ec%8a%a4%eb%a5%bc-%ec%b6%94%eb%8a%94-%ea%b3%b0%ea%b3%b0%ec%9d%b4%eb%a5%bc-%eb%b3%b8-%ec%9e%84%ec%8a%a4-2-c-baekjoon/33944/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
