<?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/%EA%B5%AC%ED%98%84/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Mon, 10 Mar 2025 09:18:35 +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>백준 10813번 (공 바꾸기, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-10813%eb%b2%88-%ea%b3%b5-%eb%b0%94%ea%be%b8%ea%b8%b0-c-baekjoon/39908/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-10813%eb%b2%88-%ea%b3%b5-%eb%b0%94%ea%be%b8%ea%b8%b0-c-baekjoon/39908/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 28 Feb 2025 02:32:58 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10813]]></category>
		<category><![CDATA[10813번]]></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[기초]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10813]]></category>
		<category><![CDATA[백준 10813번]]></category>
		<category><![CDATA[시뮬레이션]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=39908</guid>

					<description><![CDATA[<p>공 바꾸기 https://www.acmicpc.net/problem/10813 시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율 1 초 256 MB 90321 56671 50445 63.108% 문제 도현이는 바구니를 총 N개 가지고 있고, 각각의 바구니에는 1번부터 N번까지 번호가 매겨져 있다. 바구니에는 공이 1개씩 들어있고, 처음에는 바구니에 적혀있는 번호와 같은 번호가 적힌 공이 들어있다. 도현이는 앞으로 M번 공을 바꾸려고 한다. 도현이는 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-10813%eb%b2%88-%ea%b3%b5-%eb%b0%94%ea%be%b8%ea%b8%b0-c-baekjoon/39908/">백준 10813번 (공 바꾸기, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">공 바꾸기 <img decoding="async" width="35" height="45" class="wp-image-37920" style="width: 35px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Bronze_2.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Bronze_2.jpg 1250w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_2-234x300.jpg 234w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_2-768x983.jpg 768w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_2-1200x1536.jpg 1200w" sizes="(max-width: 35px) 100vw, 35px" /></h2>



<p><a href="https://www.acmicpc.net/problem/10813" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/10813</a></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">메모리 제한</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">90321</td><td class="has-text-align-left" data-align="left">56671</td><td class="has-text-align-left" data-align="left">50445</td><td class="has-text-align-left" data-align="left">63.108%</td></tr></tbody></table></figure>



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



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



<p>도현이는 바구니를 총 N개 가지고 있고, 각각의 바구니에는 1번부터 N번까지 번호가 매겨져 있다. </p>



<p>바구니에는 공이 1개씩 들어있고, 처음에는 바구니에 적혀있는 번호와 같은 번호가 적힌 공이 들어있다.</p>



<p>도현이는 앞으로 M번 공을 바꾸려고 한다. 도현이는 공을 바꿀 바구니 2개를 선택하고, 두 바구니에 들어있는 공을 서로 교환한다.</p>



<p>공을 어떻게 바꿀지가 주어졌을 때, M번 공을 바꾼 이후에 각 바구니에 어떤 공이 들어있는지 구하는 프로그램을 작성하시오.</p>



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



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



<p>첫째 줄에 N (1 ≤ N ≤ 100)과 M (1 ≤ M ≤ 100)이 주어진다.</p>



<p>둘째 줄부터 M개의 줄에 걸쳐서 공을 교환할 방법이 주어진다. </p>



<p>각 방법은 두 정수 i j로 이루어져 있으며, i번 바구니와 j번 바구니에 들어있는 공을 교환한다는 뜻이다. (1 ≤ i ≤ j ≤ N)</p>



<p>도현이는 입력으로 주어진 순서대로 공을 교환한다.</p>



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



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



<p>1번 바구니부터 N번 바구니에 들어있는 공의 번호를 공백으로 구분해 출력한다.</p>



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



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



<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 4
1 2
3 4
1 4
2 2</pre>



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



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



<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 1 4 2 5</pre>



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



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



<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/onjo0127" target="_blank" rel="noreferrer noopener">onjo0127</a></li>
</ul>



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



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



<ul class="wp-block-list">
<li><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/141" 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)"/>



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



<p>단순한 구현 문제</p>



<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>

using namespace std;

int N, M;
int Arr[101] = { 0 };

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

	cin >> N >> M;

    for (int i = 1; i &lt;= N; i++)
        Arr[i] = i;

	int t1, t2;

    for (int i = 0; i &lt; M; i++) {
        cin >> t1 >> t2;
		swap(Arr[t1], Arr[t2]);
    }

    for (int i = 1; i &lt;= N; i++)
		cout &lt;&lt; Arr[i] &lt;&lt; " ";

    return 0;
}
</pre>



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



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="965" height="82" src="https://lycos7560.com/wp-content/uploads/2025/03/image.png" alt="" class="wp-image-39909" srcset="https://lycos7560.com/wp-content/uploads/2025/03/image.png 965w, https://lycos7560.com/wp-content/uploads/2025/03/image-300x25.png 300w, https://lycos7560.com/wp-content/uploads/2025/03/image-768x65.png 768w" sizes="(max-width: 965px) 100vw, 965px" /></figure>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-10813%eb%b2%88-%ea%b3%b5-%eb%b0%94%ea%be%b8%ea%b8%b0-c-baekjoon/39908/">백준 10813번 (공 바꾸기, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-10813%eb%b2%88-%ea%b3%b5-%eb%b0%94%ea%be%b8%ea%b8%b0-c-baekjoon/39908/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 30804번 (과일 탕후루, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30804%eb%b2%88-%ea%b3%bc%ec%9d%bc-%ed%83%95%ed%9b%84%eb%a3%a8-c-baekjoon/39911/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30804%eb%b2%88-%ea%b3%bc%ec%9d%bc-%ed%83%95%ed%9b%84%eb%a3%a8-c-baekjoon/39911/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 05 Jan 2025 05:16:08 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[30804]]></category>
		<category><![CDATA[30804번]]></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[두 포인터]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 30804]]></category>
		<category><![CDATA[백준 30804번]]></category>
		<category><![CDATA[브루트 포스]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=39911</guid>

					<description><![CDATA[<p>과일 탕후루 https://www.acmicpc.net/problem/30804 시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율 2 초 1024 MB 13648 4768 3826 33.976% 문제 은하는 긴 막대에 N개의 과일이 꽂혀있는 과일 탕후루를 만들었습니다. 과일의 각 종류에는 1부터 9까지의 번호가 붙어있고, 앞쪽부터 차례로  번 과일이 꽂혀있습니다. 과일 탕후루를 다 만든 은하가 주문을 다시 확인해보니 과일을 두 종류 이하로 사용해 달라는 요청이 [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30804%eb%b2%88-%ea%b3%bc%ec%9d%bc-%ed%83%95%ed%9b%84%eb%a3%a8-c-baekjoon/39911/">백준 30804번 (과일 탕후루, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">과일 탕후루 <img decoding="async" width="30" height="38" class="wp-image-37910" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Sliver_2.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Sliver_2.jpg 400w, https://lycos7560.com/wp-content/uploads/2024/03/Sliver_2-234x300.jpg 234w" sizes="(max-width: 30px) 100vw, 30px" /></h2>



<p><a href="https://www.acmicpc.net/problem/30804" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/30804</a></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">메모리 제한</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">1024 MB</td><td class="has-text-align-left" data-align="left">13648</td><td class="has-text-align-left" data-align="left">4768</td><td class="has-text-align-left" data-align="left">3826</td><td class="has-text-align-left" data-align="left">33.976%</td></tr></tbody></table></figure>



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



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



<p>은하는 긴 막대에 N개의 과일이 꽂혀있는 과일 탕후루를 만들었습니다. </p>



<p>과일의 각 종류에는 1부터 9까지의 번호가 붙어있고, 앞쪽부터 차례로 <img decoding="async" width="104" height="22" class="wp-image-39912" style="width: 104px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-1.png" alt=""> 번 과일이 꽂혀있습니다. </p>



<p>과일 탕후루를 다 만든 은하가 주문을 다시 확인해보니 과일을 두 종류 이하로 사용해 달라는 요청이 있었습니다.</p>



<p>탕후루를 다시 만들 시간이 없었던 은하는, 막대의 앞쪽과 뒤쪽에서 몇 개의 과일을 빼서 두 종류 이하의 과일만 남기기로 했습니다. </p>



<p>앞에서 a개, 뒤에서 b개의 과일을 빼면 <img decoding="async" width="200" height="17" class="wp-image-39913" style="width: 200px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-2.png" alt=""> 번 과일, 총 N &#8211; (a + b)개가 꽂혀있는 탕후루가 됩니다. <img decoding="async" width="150" height="27" class="wp-image-39914" style="width: 150px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-3.png" alt=""></p>



<p>이렇게 만들 수 있는 과일을 두 종류 이하로 사용한 탕후루 중에서, 과일의 개수가 가장 많은 탕후루의 과일 개수를 구하세요.</p>



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



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



<p>첫 줄에 과일의 개수 N이 주어집니다. <img decoding="async" width="145" height="23" class="wp-image-39915" style="width: 145px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-4.png" alt=""></p>



<p>둘째 줄에 탕후루에 꽂힌 과일을 의미하는 N개의 정수 <img decoding="async" width="78" height="24" class="wp-image-39917" style="width: 78px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-6.png" alt=""> 이 공백으로 구분되어 주어집니다. <img decoding="async" width="98" height="22" class="wp-image-39916" style="width: 98px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-5.png" alt=""></p>



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



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



<p>문제의 방법대로 만들 수 있는 과일을 두 종류 이하로 사용한 탕후루 중에서, 과일의 개수가 가장 많은 탕후루의 과일 개수를 첫째 줄에 출력하세요.</p>



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



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



<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
5 1 1 2 1</pre>



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



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



<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</pre>



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



<p>과일을 앞에서 1개, 뒤에서 0개의 과일을 빼면 남은 과일은 1, 1, 2, 1번 과일이 꽂혀있는 탕후루가 됩니다. </p>



<p>과일의 개수는 4개입니다.</p>



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



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



<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
1 1 1</pre>



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



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



<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:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>탕후루가 이미 두 종류 이하의 과일로만 이루어져 있습니다.</p>



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



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



<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="">9
1 2 3 4 5 6 7 8 9</pre>



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



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



<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:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>과일을 앞에서 3개, 뒤에서 4개의 과일을 빼면 남은 과일은 4, 5번 과일이 꽂혀있는 탕후루가 됩니다. </p>



<p>과일의 개수는 2개입니다.</p>



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



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



<p><a href="https://www.acmicpc.net/category/45" target="_blank" rel="noreferrer noopener">Contest</a> > <a href="https://www.acmicpc.net/category/859" target="_blank" rel="noreferrer noopener">solved.ac</a> > <a href="https://www.acmicpc.net/category/1003" target="_blank" rel="noreferrer noopener">solved.ac Grand Arena #3</a> > <a href="https://www.acmicpc.net/category/detail/4059" target="_blank" rel="noreferrer noopener">Division 2</a> C번</p>



<p><a href="https://www.acmicpc.net/category/45" target="_blank" rel="noreferrer noopener">Contest</a> > <a href="https://www.acmicpc.net/category/859" target="_blank" rel="noreferrer noopener">solved.ac</a> > <a href="https://www.acmicpc.net/category/1003" target="_blank" rel="noreferrer noopener">solved.ac Grand Arena #3</a> > <a href="https://www.acmicpc.net/category/detail/4060" target="_blank" rel="noreferrer noopener">Division 1</a> A번</p>



<ul class="wp-block-list">
<li>문제를 만든 사람: <a href="https://www.acmicpc.net/user/cologne">cologne</a>, <a href="https://www.acmicpc.net/user/havana723">havana723</a>, <a href="https://www.acmicpc.net/user/solvedac">solvedac</a></li>



<li>문제를 검수한 사람: <a href="https://www.acmicpc.net/user/cologne">cologne</a>, <a href="https://www.acmicpc.net/user/cozyyg">cozyyg</a>, <a href="https://www.acmicpc.net/user/gs18115">gs18115</a>, <a href="https://www.acmicpc.net/user/moonrabbit2">moonrabbit2</a>, <a href="https://www.acmicpc.net/user/seonah">seonah</a></li>
</ul>



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



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



<ul class="wp-block-list">
<li><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/125" target="_blank" rel="noreferrer noopener">브루트포스 알고리즘</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/80" 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)"/>



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



<p>map 자료구조, 두 포인터 알고리즘을 이용하여 문제를 해결</p>



<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;map>

using namespace std;

int N;
int Arr[200000];

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

    cin >> N;

    for (int i = 0; i &lt; N; i++)
        cin >> Arr[i];

    map&lt;int, int> fruitCount;
    int left = 0, right = 0, maxLen = 0;

    while (right &lt; N) 
    {
        // 오른쪽 과일 추가
        fruitCount[Arr[right]]++;

        while (fruitCount.size() > 2) 
        { 
            // 과일 종류가 2개 초과하면 줄이기
            fruitCount[Arr[left]]--;
            if (fruitCount[Arr[left]] == 0)
                fruitCount.erase(Arr[left]);
            left++;
        }

        // 최대 길이 갱신
        maxLen = max(maxLen, right - left + 1);
        right++;
    }

    cout &lt;&lt; maxLen &lt;&lt; "\n";

    return 0;
}
</pre>



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



<p>Arr[] 범위를 20,000으로 오타를 내고 제출하여 계속 오답을 받았다. (올바른 범위는 200,000) </p>



<figure class="wp-block-image size-full"><img decoding="async" width="961" height="181" src="https://lycos7560.com/wp-content/uploads/2025/03/image-7.png" alt="" class="wp-image-39919" srcset="https://lycos7560.com/wp-content/uploads/2025/03/image-7.png 961w, https://lycos7560.com/wp-content/uploads/2025/03/image-7-300x57.png 300w, https://lycos7560.com/wp-content/uploads/2025/03/image-7-768x145.png 768w" sizes="(max-width: 961px) 100vw, 961px" /></figure>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30804%eb%b2%88-%ea%b3%bc%ec%9d%bc-%ed%83%95%ed%9b%84%eb%a3%a8-c-baekjoon/39911/">백준 30804번 (과일 탕후루, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30804%eb%b2%88-%ea%b3%bc%ec%9d%bc-%ed%83%95%ed%9b%84%eb%a3%a8-c-baekjoon/39911/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 30802번 (웰컴 키트, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30802%eb%b2%88-%ec%9b%b0%ec%bb%b4-%ed%82%a4%ed%8a%b8-c-baekjoon/39921/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30802%eb%b2%88-%ec%9b%b0%ec%bb%b4-%ed%82%a4%ed%8a%b8-c-baekjoon/39921/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 24 Sep 2024 09:03:38 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[30802]]></category>
		<category><![CDATA[30802번]]></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[백준 30802번]]></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=39921</guid>

					<description><![CDATA[<p>웰컴 키트 https://www.acmicpc.net/problem/30802 시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율 0.1 초 1024 MB 22145 11853 11012 53.443% 문제 2024년 2월 3일 개최 예정인 온사이트 그랜드 아레나에서는 참가자들에게 티셔츠 한 장과 펜 한 자루가 포함된 웰컴 키트를 나눠줄 예정입니다. 키트를 제작하는 업체는 다음과 같은 조건으로만 주문이 가능합니다. 총 N명의 참가자 중 S, M, [&#8230;]</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30802%eb%b2%88-%ec%9b%b0%ec%bb%b4-%ed%82%a4%ed%8a%b8-c-baekjoon/39921/">백준 30802번 (웰컴 키트, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">웰컴 키트 <img decoding="async" width="30" height="38" class="wp-image-37924" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Bronze_3.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Bronze_3.jpg 1250w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_3-234x300.jpg 234w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_3-768x983.jpg 768w, https://lycos7560.com/wp-content/uploads/2024/03/Bronze_3-1200x1536.jpg 1200w" sizes="(max-width: 30px) 100vw, 30px" /></h2>



<p><a href="https://www.acmicpc.net/problem/30802" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/30802</a></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">메모리 제한</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">0.1 초</td><td class="has-text-align-left" data-align="left">1024 MB</td><td class="has-text-align-left" data-align="left">22145</td><td class="has-text-align-left" data-align="left">11853</td><td class="has-text-align-left" data-align="left">11012</td><td class="has-text-align-left" data-align="left">53.443%</td></tr></tbody></table></figure>



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



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



<p>2024년 2월 3일 개최 예정인 온사이트 그랜드 아레나에서는 참가자들에게 티셔츠 한 장과 펜 한 자루가 포함된 웰컴 키트를 나눠줄 예정입니다. </p>



<p>키트를 제작하는 업체는 다음과 같은 조건으로만 주문이 가능합니다.</p>



<ul class="wp-block-list">
<li>티셔츠는 S, M, L, XL, XXL, 그리고 XXXL의 6가지 사이즈가 있습니다. 티셔츠는 같은 사이즈의 T장 묶음으로만 주문할 수 있습니다.</li>



<li>펜은 한 종류로, P자루씩 묶음으로 주문하거나 한 자루씩 주문할 수 있습니다.</li>
</ul>



<p>총 N명의 참가자 중 S, M, L, XL, XXL, XXXL 사이즈의 티셔츠를 신청한 사람은 각각 S,M,L,XL,XXL,XXXL명입니다. </p>



<p>티셔츠는 남아도 되지만 부족해서는 안 되고 신청한 사이즈대로 나눠주어야 합니다. </p>



<p>펜은 남거나 부족해서는 안 되고 정확히 참가자 수만큼 준비되어야 합니다.</p>



<p>티셔츠를 T장씩 최소 몇 묶음 주문해야 하는지, 그리고 펜을 P자루씩 최대 몇 묶음 주문할 수 있고, 그 때 펜을 한 자루씩 몇 개 주문하는지 구하세요.</p>



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



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



<p>첫 줄에 참가자의 수 N이 주어집니다. <img decoding="async" width="109" height="25" class="wp-image-39922" style="width: 109px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-8.png" alt=""></p>



<p>둘째 줄에 티셔츠 사이즈별 신청자의 수 S, M, L, XL , XXL, XXXL이 공백으로 구분되어 주어집니다.  (0 ≤ S, M, L, XL, XXL, XXXL ≤ N; S + M + L + XL + XXL + XXXL = N)</p>



<p>셋째 줄에 정수 티셔츠와 펜의 묶음 수를 의미하는 정수 T와 P가 공백으로 구분되어 주어집니다. <img decoding="async" width="127" height="23" class="wp-image-39923" style="width: 127px;" src="https://lycos7560.com/wp-content/uploads/2025/03/image-9.png" alt=""></p>



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



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



<p>첫 줄에 티셔츠를 T장씩 최소 몇 묶음 주문해야 하는지 출력하세요.</p>



<p>다음 줄에 펜을 P자루씩 최대 몇 묶음 주문할 수 있는지와, 그 때 펜을 한 자루씩 몇 개 주문하는지 구하세요.</p>



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



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



<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="">23
3 1 4 1 5 9
5 7</pre>



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



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



<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="">7
3 2</pre>



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



<p>S, M, L, XL, XXL 사이즈 티셔츠를 1 묶음씩 구매하고 XXXL 사이즈 티셔츠를 2묶음 구매합니다.</p>



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



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



<p><a href="https://www.acmicpc.net/category/45" target="_blank" rel="noreferrer noopener">Contest</a> > <a href="https://www.acmicpc.net/category/859" target="_blank" rel="noreferrer noopener">solved.ac</a> > <a href="https://www.acmicpc.net/category/1003" target="_blank" rel="noreferrer noopener">solved.ac Grand Arena #3</a> > <a href="https://www.acmicpc.net/category/detail/4059" target="_blank" rel="noreferrer noopener">Division 2</a> A번</p>



<ul class="wp-block-list">
<li>문제를 검수한 사람: <a href="https://www.acmicpc.net/user/cologne" target="_blank" rel="noreferrer noopener">cologne</a>, <a href="https://www.acmicpc.net/user/cozyyg" target="_blank" rel="noreferrer noopener">cozyyg</a>, <a href="https://www.acmicpc.net/user/gs18115" target="_blank" rel="noreferrer noopener">gs18115</a>, <a href="https://www.acmicpc.net/user/seonah" target="_blank" rel="noreferrer noopener">seonah</a>, <a href="https://www.acmicpc.net/user/shiftpsh" target="_blank" rel="noreferrer noopener">shiftpsh</a></li>



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



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



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



<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/102" target="_blank" rel="noreferrer noopener">구현</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/121" 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)"/>



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



<p>단순한 사칙 연산을 구현하는 문제</p>



<p>문제의 내용을 그대로 구현만 하면 되어서 별다른 로직이 없다.</p>



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

using namespace std;

int N, S, M, L, XL, XXL, XXXL, T, P;

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

    cin >> N >> S >> M >> L >> XL >> XXL >> XXXL >> T >> P;

    int Res = 0;
    
    Res += (int)(S / T) + (int)(M / T) + (int)(L / T) + (int)(XL / T) + (int)(XXL / T) + (int)(XXXL / T);
    if (S % T > 0) Res++;
    if (M % T > 0) Res++;
    if (L % T > 0) Res++;
    if (XL % T > 0) Res++;
    if (XXL % T > 0) Res++;
    if (XXXL % T > 0) Res++;

    cout &lt;&lt; Res &lt;&lt; "\n";
    cout &lt;&lt; (int)(N / P) &lt;&lt; " " &lt;&lt; N % P;

    return 0;
}
</pre>



<p></p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30802%eb%b2%88-%ec%9b%b0%ec%bb%b4-%ed%82%a4%ed%8a%b8-c-baekjoon/39921/">백준 30802번 (웰컴 키트, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-30802%eb%b2%88-%ec%9b%b0%ec%bb%b4-%ed%82%a4%ed%8a%b8-c-baekjoon/39921/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2711번 (오타맨 고창영, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2711%eb%b2%88-%ec%98%a4%ed%83%80%eb%a7%a8-%ea%b3%a0%ec%b0%bd%ec%98%81-c-baekjoon/37858/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2711%eb%b2%88-%ec%98%a4%ed%83%80%eb%a7%a8-%ea%b3%a0%ec%b0%bd%ec%98%81-c-baekjoon/37858/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Thu, 22 Feb 2024 15:52:58 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2711]]></category>
		<category><![CDATA[2711번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[Bronze]]></category>
		<category><![CDATA[Bronze2]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[index]]></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[백준 2711]]></category>
		<category><![CDATA[백준 2711번]]></category>
		<category><![CDATA[브론즈2]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[오타맨 고창영]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=37858</guid>

					<description><![CDATA[<p>백준 2711번 '오타맨 고창영' 문제에 대한 글입니다. 단순한 구현 문제입니다. (This is about the issue of '오타맨 고창영' BaekJoon No. 2711. It's a simple implementation question.)</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2711%eb%b2%88-%ec%98%a4%ed%83%80%eb%a7%a8-%ea%b3%a0%ec%b0%bd%ec%98%81-c-baekjoon/37858/">백준 2711번 (오타맨 고창영, 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>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="5078714126"></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-75779d84      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">오타맨 고창영 <img decoding="async" width="30" height="38" class="wp-image-37893" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/02/Bronze_2.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/02/Bronze_2.jpg 1250w, https://lycos7560.com/wp-content/uploads/2024/02/Bronze_2-234x300.jpg 234w, https://lycos7560.com/wp-content/uploads/2024/02/Bronze_2-768x983.jpg 768w, https://lycos7560.com/wp-content/uploads/2024/02/Bronze_2-1200x1536.jpg 1200w" sizes="(max-width: 30px) 100vw, 30px" /></h1>



<p><a href="https://www.acmicpc.net/problem/2711" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2711</a></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">메모리 제한</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">128 MB</td><td class="has-text-align-left" data-align="left">9891</td><td class="has-text-align-left" data-align="left">6611</td><td class="has-text-align-left" data-align="left">5977</td><td class="has-text-align-left" data-align="left">68.599%</td></tr></tbody></table></figure>



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



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



<p>고창영은 맨날 오타를 낸다. 창영이가 오타를 낸 문장과 오타를 낸 위치가 주어졌을 때, 오타를 지운 문자열을 출력하는 프로그램을 작성하시오.</p>



<p>창영이는 오타를 반드시 1개만 낸다.</p>



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



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



<p>첫째 줄에 테스트 케이스의 개수 T(1&lt;=T&lt;=1,000)가 주어진다. </p>



<p>각 테스트 케이스는 한 줄로 구성되어 있다. 첫 숫자는 창영이가 오타를 낸 위치이고, 두 번째 문자열은 창영이가 친 문자열이다. </p>



<p>문자열의 가장 첫 문자는 1번째 문자이고, 문자열의 길이는 80을 넘지 않고, 대문자로만 이루어져 있다. </p>



<p>오타를 낸 위치는 문자열 길이보다 작거나 같다.</p>



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



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



<p>각 테스트 케이스에 대해 오타를 지운 문자열을 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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
4 MISSPELL
1 PROGRAMMING
7 CONTEST
3 BALLOON</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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="">MISPELL
ROGRAMMING
CONTES
BALOON</pre>



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



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



<p><a href="https://www.acmicpc.net/category/1" target="_blank" rel="noreferrer noopener">ICPC</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/7" target="_blank" rel="noreferrer noopener">Regionals</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/8" target="_blank" rel="noreferrer noopener">North America</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/9" target="_blank" rel="noreferrer noopener">Greater New York Region</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/detail/9" target="_blank" rel="noreferrer noopener">2007 Greater New York Programming Contest</a>&nbsp;A번</p>



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



<li>잘못된 데이터를 찾은 사람:&nbsp;<a href="https://www.acmicpc.net/user/occidere" target="_blank" rel="noreferrer noopener">occidere</a></li>
</ul>



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



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



<ul class="wp-block-list">
<li><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>
</ul>



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



<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)"/>



<p>단순한 구현 문제입니다. </p>



<p>특정 인덱스의 문자열을 어떤 방식으로 출력에서 제외할 것 인가를 구현하는 문제입니다.</p>



<p>아래의 코드는 주어진 문자열을 순회하면서 오타의 인덱스인지 확인 후 출력하는 코드입니다.</p>



<p> </p>



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



<h2 class="wp-block-heading has-large-font-size">통과된 코드</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>

using namespace std;

int main()
{
	int _TestCase, _TypingError;

	cin >> _TestCase;

	while (_TestCase--) 
	{
		string _Str;
		cin >> _TypingError >> _Str;
		int _l = _Str.length(); 
		_TypingError--;
		for (int i = 0; i &lt; _l; i++) 
		{
			if (i == _TypingError)
				continue;

			cout &lt;&lt; _Str[i];

		}

		cout &lt;&lt; '\n';
	}

	return 0;
}</pre>



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



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



<figure class="wp-block-image size-full"><img decoding="async" width="967" height="84" src="https://lycos7560.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-37859" srcset="https://lycos7560.com/wp-content/uploads/2024/02/image.png 967w, https://lycos7560.com/wp-content/uploads/2024/02/image-300x26.png 300w, https://lycos7560.com/wp-content/uploads/2024/02/image-768x67.png 768w" sizes="(max-width: 967px) 100vw, 967px" /></figure>



<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="4386247858"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2711%eb%b2%88-%ec%98%a4%ed%83%80%eb%a7%a8-%ea%b3%a0%ec%b0%bd%ec%98%81-c-baekjoon/37858/">백준 2711번 (오타맨 고창영, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2711%eb%b2%88-%ec%98%a4%ed%83%80%eb%a7%a8-%ea%b3%a0%ec%b0%bd%ec%98%81-c-baekjoon/37858/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2636번 (치즈, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2636%eb%b2%88-%ec%b9%98%ec%a6%88-c-baekjoon/36604/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2636%eb%b2%88-%ec%b9%98%ec%a6%88-c-baekjoon/36604/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sat, 26 Aug 2023 02:52:29 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2636]]></category>
		<category><![CDATA[2636번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[BFS]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Gold]]></category>
		<category><![CDATA[Gold4]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[골드]]></category>
		<category><![CDATA[골드4]]></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[백준 2636]]></category>
		<category><![CDATA[백준 2636번]]></category>
		<category><![CDATA[시뮬레이션]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[치즈]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=36604</guid>

					<description><![CDATA[<p>백준 2636번 '치즈' 문제에 대한 글입니다. BFS 알고리즘을 이용하여 해결하였습니다.(This article is about the question of "Cheese" in Baekjoon Number 2636. It was solved using the BFS algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2636%eb%b2%88-%ec%b9%98%ec%a6%88-c-baekjoon/36604/">백준 2636번 (치즈, 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>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="5078714126"></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-75779d84      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">치즈 <img decoding="async" width="30" height="38" class="wp-image-37904" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Gold_4.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Gold_4.jpg 400w, https://lycos7560.com/wp-content/uploads/2024/03/Gold_4-234x300.jpg 234w" sizes="(max-width: 30px) 100vw, 30px" /></h1>



<p><a href="https://www.acmicpc.net/problem/2636" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2636</a></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">메모리 제한</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">128 MB</td><td class="has-text-align-left" data-align="left">25672</td><td class="has-text-align-left" data-align="left">14240</td><td class="has-text-align-left" data-align="left">10335</td><td class="has-text-align-left" data-align="left">54.602%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>아래 &lt;그림 1&gt;과 같이 정사각형 칸들로 이루어진 사각형 모양의 판이 있고, </p>



<p>그 위에 얇은 치즈(회색으로 표시된 부분)가 놓여 있다. </p>



<p>판의 가장자리(&lt;그림 1&gt;에서 네모 칸에 X친 부분)에는 치즈가 놓여 있지 않으며 치즈에는 하나 이상의 구멍이 있을 수 있다.</p>



<p>이 치즈를 공기 중에 놓으면 녹게 되는데 공기와 접촉된 칸은 한 시간이 지나면 녹아 없어진다. </p>



<p>치즈의 구멍 속에는 공기가 없지만 구멍을 둘러싼 치즈가 녹아서 구멍이 열리면 구멍 속으로 공기가 들어가게 된다. </p>



<p>&lt;그림 1&gt;의 경우, 치즈의 구멍을 둘러싼 치즈는 녹지 않고 ‘c’로 표시된 부분만 한 시간 후에 녹아 없어져서 &lt;그림 2&gt;와 같이 된다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="379" height="408" src="https://lycos7560.com/wp-content/uploads/2023/08/image-25.png" alt="" class="wp-image-36609" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-25.png 379w, https://lycos7560.com/wp-content/uploads/2023/08/image-25-279x300.png 279w" sizes="(max-width: 379px) 100vw, 379px" /></figure>



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



<p>다시 한 시간 후에는 &lt;그림 2&gt;에서 ‘c’로 표시된 부분이 녹아 없어져서 &lt;그림 3&gt;과 같이 된다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="371" height="860" src="https://lycos7560.com/wp-content/uploads/2023/08/image-26.png" alt="" class="wp-image-36610" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-26.png 371w, https://lycos7560.com/wp-content/uploads/2023/08/image-26-129x300.png 129w" sizes="(max-width: 371px) 100vw, 371px" /></figure>



<p>&lt;그림 3&gt;은 원래 치즈의 두 시간 후 모양을 나타내고 있으며, </p>



<p>남은 조각들은 한 시간이 더 지나면 모두&nbsp;녹아 없어진다. </p>



<p>그러므로 처음 치즈가 모두 녹아 없어지는 데는 세 시간이 걸린다. </p>



<p>&lt;그림 3&gt;과 같이 치즈가 녹는 과정에서 여러 조각으로 나누어 질 수도 있다.</p>



<p>입력으로 사각형 모양의 판의 크기와 한 조각의 치즈가 판 위에 주어졌을 때, </p>



<p><strong>공기 중에서 치즈가 모두 녹아 없어지는 데 걸리는 시간과 </strong></p>



<p><strong>모두 녹기 한 시간 전에 남아있는 치즈조각이 놓여 있는 칸의 개수를 구하는 프로그램을 작성하시오.</strong></p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫째 줄에는 사각형 모양 판의 세로와 가로의 길이가 양의 정수로 주어진다. </p>



<p>세로와 가로의 길이는 최대 100이다. </p>



<p>판의 각 가로줄의 모양이 윗 줄부터 차례로 둘째 줄부터 마지막 줄까지 주어진다. </p>



<p>치즈가 없는 칸은 0, 치즈가 있는 칸은 1로 주어지며 각 숫자 사이에는 빈칸이 하나씩 있다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>첫째 줄에는 치즈가 모두 녹아서 없어지는 데 걸리는 시간을 출력하고, </p>



<p>둘째 줄에는 모두 녹기 한 시간 전에 남아있는 치즈조각이 놓여 있는 칸의 개수를 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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="">13 12
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0
0 1 1 1 0 0 0 1 1 0 0 0
0 1 1 1 1 1 1 0 0 0 0 0
0 1 1 1 1 1 0 1 1 0 0 0
0 1 1 1 1 0 0 1 1 0 0 0
0 0 1 1 0 0 0 1 1 0 0 0
0 0 1 1 1 1 1 1 1 0 0 0
0 0 1 1 1 1 1 1 1 0 0 0
0 0 1 1 1 1 1 1 1 0 0 0
0 0 1 1 1 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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
5</pre>



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



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<p><a href="https://www.acmicpc.net/category/2">Olympiad</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/55">한국정보올림피아드</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/78">KOI 2000</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/detail/391">초등부</a>&nbsp;3번</p>



<ul class="wp-block-list">
<li>문제의 오타를 찾은 사람:&nbsp;<a href="https://www.acmicpc.net/user/compro0317">compro0317</a>,&nbsp;<a href="https://www.acmicpc.net/user/shawn050912">shawn050912</a></li>



<li>데이터를 추가한 사람:&nbsp;<a href="https://www.acmicpc.net/user/jung2381187">jung2381187</a></li>
</ul>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



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



<li><a href="https://www.acmicpc.net/problem/tag/7">그래프 이론</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/11">그래프 탐색</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/141">시뮬레이션</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/126">너비 우선 탐색</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)"/>



<h2 class="wp-block-heading has-large-font-size">통과된 코드</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;queue>
#include &lt;vector>
using namespace std;
constexpr short MAX = 100;
short _N, _M, _Cheese = 0;
short _DxDy[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };
bool _Map[MAX][MAX];
bool _IsVisted[MAX][MAX];
vector&lt;short> Records;
vector&lt;pair&lt;short, short>> _Next;
queue&lt;pair&lt;short, short>> BFSqueue;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> _N >> _M;
	bool _t;
	for (short i = 0; i &lt; _N; i++)
		for (short j = 0; j &lt; _M; j++) {
			cin >> _t;
			_Map[i][j] = _t;
			if (_t == 1)
				_Cheese++;
		}
	short _time = 0;
	while (true) {
		Records.push_back(_Cheese);
		if (_Cheese == 0)
			break;
		for (short i = 0; i &lt; _N; i++)
			for (short j = 0; j &lt; _M; j++)
				_IsVisted[i][j] = false;
		_Next.clear();
		BFSqueue.push({ 0,0 });
		_IsVisted[0][0] = true;
		while (!BFSqueue.empty()) {
			pair&lt;short, short> _pos = BFSqueue.front();
			BFSqueue.pop();
			for (short i = 0; i &lt; 4; i++) {
				short _dx = _pos.first + _DxDy[i][0];
				short _dy = _pos.second + _DxDy[i][1];

				if (_dx &lt; 0 || _dy &lt; 0 || _dx >= _N || _dy >= _M)
					continue;
				if (_IsVisted[_dx][_dy])
					continue;
				if (_Map[_dx][_dy] == 1) {
					_Next.push_back({ _dx, _dy });
					_IsVisted[_dx][_dy] = true;
					continue;
				}

				_IsVisted[_dx][_dy] = true;
				BFSqueue.push({ _dx, _dy});
			}
		}

		for (auto&amp; it : _Next) {
			_Map[it.first][it.second] = 0;
			_Cheese--;
		}

		_time++;
	}

	cout &lt;&lt; _time &lt;&lt; "\n" &lt;&lt; Records[Records.size() - 2];


	return 0;
}</pre>



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



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="1063" height="86" src="https://lycos7560.com/wp-content/uploads/2023/08/image-24.png" alt="" class="wp-image-36605" style="aspect-ratio:12.28;width:1045px;height:auto" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-24.png 1063w, https://lycos7560.com/wp-content/uploads/2023/08/image-24-300x24.png 300w, https://lycos7560.com/wp-content/uploads/2023/08/image-24-768x62.png 768w" sizes="(max-width: 1063px) 100vw, 1063px" /></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="4386247858"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2636%eb%b2%88-%ec%b9%98%ec%a6%88-c-baekjoon/36604/">백준 2636번 (치즈, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2636%eb%b2%88-%ec%b9%98%ec%a6%88-c-baekjoon/36604/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2573번 (빙산, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2573%eb%b2%88-%eb%b9%99%ec%82%b0-c-baekjoon/36585/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2573%eb%b2%88-%eb%b9%99%ec%82%b0-c-baekjoon/36585/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 25 Aug 2023 16:57:28 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2573]]></category>
		<category><![CDATA[2573번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[BFS]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Gold]]></category>
		<category><![CDATA[Gold4]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[골드]]></category>
		<category><![CDATA[골드4]]></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[백준 2573]]></category>
		<category><![CDATA[백준 2573번]]></category>
		<category><![CDATA[빙산]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=36585</guid>

					<description><![CDATA[<p>백준 2573번 '빙산' 문제에 대한 글입니다. BFS 알고리즘을 이용하여 해결하였습니다. (This article is about the issue of "ice mountain" in Baekjoon Number 2573. It was solved using the BFS algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2573%eb%b2%88-%eb%b9%99%ec%82%b0-c-baekjoon/36585/">백준 2573번 (빙산, 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>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="5078714126"></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-75779d84      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">빙산 <img decoding="async" width="30" height="38" class="wp-image-37904" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Gold_4.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Gold_4.jpg 400w, https://lycos7560.com/wp-content/uploads/2024/03/Gold_4-234x300.jpg 234w" sizes="(max-width: 30px) 100vw, 30px" /></h1>



<p><a href="https://www.acmicpc.net/problem/2573" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2573</a></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">메모리 제한</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">66795</td><td class="has-text-align-left" data-align="left">18943</td><td class="has-text-align-left" data-align="left">12600</td><td class="has-text-align-left" data-align="left">25.842%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>지구 온난화로 인하여 북극의 빙산이 녹고 있다. </p>



<p>빙산을 그림 1과 같이 2차원 배열에 표시한다고 하자. </p>



<p>빙산의 각 부분별 높이 정보는 배열의 각 칸에 양의 정수로 저장된다. </p>



<p>빙산 이외의 바다에 해당되는 칸에는 0이 저장된다. </p>



<p>그림 1에서 빈칸은 모두 0으로 채워져 있다고 생각한다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="598" height="362" src="https://lycos7560.com/wp-content/uploads/2023/08/image-22.png" alt="" class="wp-image-36590" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-22.png 598w, https://lycos7560.com/wp-content/uploads/2023/08/image-22-300x182.png 300w" sizes="(max-width: 598px) 100vw, 598px" /><figcaption class="wp-element-caption">그림 1. 행의 개수가 5이고 열의 개수가 7인 2차원 배열에 저장된 빙산의 높이 정보</figcaption></figure>



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



<p>빙산의 높이는 바닷물에 많이 접해있는 부분에서 더 빨리 줄어들기 때문에, </p>



<p>배열에서 빙산의 각 부분에 해당되는 칸에 있는 높이는 일년마다 그 칸에 동서남북 네 방향으로 붙어있는 0이 저장된 칸의 개수만큼 줄어든다. </p>



<p>단, 각 칸에 저장된 높이는 0보다 더 줄어들지 않는다. </p>



<p>바닷물은 호수처럼 빙산에 둘러싸여 있을 수도 있다. </p>



<p>따라서 그림 1의 빙산은 일년후에 그림 2와 같이 변형된다.</p>



<p>그림 3은 그림 1의 빙산이 2년 후에 변한 모습을 보여준다. </p>



<p>2차원 배열에서 동서남북 방향으로 붙어있는 칸들은 서로 연결되어 있다고 말한다. </p>



<p>따라서 그림 2의 빙산은 한 덩어리이지만, 그림 3의 빙산은 세 덩어리로 분리되어 있다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="636" height="900" src="https://lycos7560.com/wp-content/uploads/2023/08/image-23.png" alt="" class="wp-image-36593" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-23.png 636w, https://lycos7560.com/wp-content/uploads/2023/08/image-23-212x300.png 212w" sizes="(max-width: 636px) 100vw, 636px" /></figure>



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



<p>한 덩어리의 빙산이 주어질 때, 이 빙산이 두 덩어리 이상으로 분리되는 최초의 시간(년)을 구하는 프로그램을 작성하시오. </p>



<p>그림 1의 빙산에 대해서는 2가 답이다. </p>



<p>만일 전부 다 녹을 때까지 두 덩어리 이상으로 분리되지 않으면 프로그램은 0을 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫 줄에는 이차원 배열의 행의 개수와 열의 개수를 나타내는 두 정수 N과 M이 한 개의 빈칸을 사이에 두고 주어진다. </p>



<p>N과 M은 3 이상 300 이하이다. 그 다음 N개의 줄에는 각 줄마다 배열의 각 행을 나타내는 M개의 정수가 한 개의 빈 칸을 사이에 두고 주어진다. </p>



<p>각 칸에 들어가는 값은 0 이상 10 이하이다. </p>



<p>배열에서 빙산이 차지하는 칸의 개수, 즉, 1 이상의 정수가 들어가는 칸의 개수는 10,000 개 이하이다. </p>



<p>배열의 첫 번째 행과 열, 마지막 행과 열에는 항상 0으로 채워진다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>첫 줄에 빙산이 분리되는 최초의 시간(년)을 출력한다. </p>



<p>만일 빙산이 다 녹을 때까지 분리되지 않으면 0을 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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 7
0 0 0 0 0 0 0
0 2 4 5 3 0 0
0 3 0 2 5 2 0
0 7 6 2 4 0 0
0 0 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading has-large-font-size">예제 입력 A</h3>



<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 7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 0 0 0 
0 0 0 0 0 0 0
0 0 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 A</h3>



<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:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading has-large-font-size">예제 입력 B</h3>



<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="">7 7
0 0 0 0 0 0 0
0 1 1 0 1 1 0
0 1 9 1 9 1 0
0 1 1 1 1 1 0
0 1 1 1 1 1 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 B</h3>



<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:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<p><a href="https://www.acmicpc.net/category/2" target="_blank" rel="noreferrer noopener">Olympiad</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/55" target="_blank" rel="noreferrer noopener">한국정보올림피아드</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/69" target="_blank" rel="noreferrer noopener">KOI 2006</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/detail/364">초등부</a>&nbsp;2번</p>



<ul class="wp-block-list">
<li>잘못된 데이터를 찾은 사람:&nbsp;<a href="https://www.acmicpc.net/user/occidere" target="_blank" rel="noreferrer noopener">occidere</a>,&nbsp;<a href="https://www.acmicpc.net/user/zayne" target="_blank" rel="noreferrer noopener">zayne</a></li>
</ul>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



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



<li><a href="https://www.acmicpc.net/problem/tag/7">그래프 이론</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/11">그래프 탐색</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/126">너비 우선 탐색</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/127">깊이 우선 탐색</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)"/>



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



<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;queue>
using namespace std;
constexpr short MAX = 300;
short _MAP[2][MAX][MAX];
bool _IsVisted[MAX][MAX];
short _N, _M, _Res = 0, _Glaciers = 0, _Cluster = 0;
short _DxDy[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

void BFS(short _i, short _j)
{
	queue&lt;pair&lt;short, short>> BFSQueue;
	BFSQueue.push({ _i, _j });
	while (!BFSQueue.empty()) {
		pair&lt;short, short> _CntPos = BFSQueue.front();
		BFSQueue.pop();
		short _Sea = 0;
		for (short i = 0; i &lt; 4; i++) {
			short _dx = _CntPos.first + _DxDy[i][0];
			short _dy = _CntPos.second + _DxDy[i][1];
			if (_dx &lt; 0 || _dy &lt; 0 || _dx >= _N || _dy >= _M)
				continue;
			if (_MAP[0][_dx][_dy] &lt;= 0) {
				_Sea++;
				continue;
			}
			if (_IsVisted[_dx][_dy])
				continue;
			_IsVisted[_dx][_dy] = true;
			BFSQueue.push({ _dx, _dy });
		}
		_MAP[1][_CntPos.first][_CntPos.second] = _Sea;
	}
}


short ClusterCount()
{
	short _cnt = 0;
	for (short i = 0; i &lt; _N; i++)
		for (short j = 0; j &lt; _M; j++)
			_IsVisted[i][j] = false;
	for (short i = 0; i &lt; _N; i++)
		for (short j = 0; j &lt; _M; j++) {
			if (_MAP[0][i][j] &lt;= 0 || _IsVisted[i][j])
				continue;
			BFS(i, j);
			_cnt++;
		}
	return _cnt;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> _N >> _M;
	short _Temp;
	for (short i = 0; i &lt; _N; i++)
		for (short j = 0; j &lt; _M; j++) {
			cin >> _Temp;
			if (_Temp > 0)
				_Glaciers++;
			_MAP[0][i][j] = _Temp;
		}
	short _Cnt = 0;
	while (true) {
		_Cluster = ClusterCount();
		if (_Cluster >= 2 ) {
			_Res = _Cnt;
			break;
		}
		if (_Glaciers &lt;= 1) {
			_Res = 0; 
			break;
		}

		for (short i = 0; i &lt; _N; i++)
			for (short j = 0; j &lt; _M; j++) {
				if (_MAP[0][i][j] &lt;= 0)
					continue;
				_MAP[0][i][j] -= _MAP[1][i][j];
				if (_MAP[0][i][j] &lt;= 0)
					_Glaciers--;
			}
		_Cnt++;
	}

	cout &lt;&lt; _Res;

	return 0;
}</pre>



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



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="1205" height="190" src="https://lycos7560.com/wp-content/uploads/2023/08/image-21.png" alt="" class="wp-image-36587" style="width:867px;height:137px" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-21.png 1205w, https://lycos7560.com/wp-content/uploads/2023/08/image-21-300x47.png 300w, https://lycos7560.com/wp-content/uploads/2023/08/image-21-768x121.png 768w" sizes="(max-width: 1205px) 100vw, 1205px" /></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="4386247858"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2573%eb%b2%88-%eb%b9%99%ec%82%b0-c-baekjoon/36585/">백준 2573번 (빙산, 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-2573%eb%b2%88-%eb%b9%99%ec%82%b0-c-baekjoon/36585/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 14502번 (연구소, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-14502%eb%b2%88-%ec%97%b0%ea%b5%ac%ec%86%8c-c-baekjoon/35759/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-14502%eb%b2%88-%ec%97%b0%ea%b5%ac%ec%86%8c-c-baekjoon/35759/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 07 Jul 2023 23:00:51 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[14502]]></category>
		<category><![CDATA[14502번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[BFS]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[lab]]></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[백준 14502]]></category>
		<category><![CDATA[백준 14502번]]></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=35759</guid>

					<description><![CDATA[<p>백준 14502번 '연구소' 문제에 대한 글입니다. 'BruteForce' 와 'BFS Search' 을 이용하여 문제를 해결하였습니다. (This article is about Baekjoon Number 14502 'Lab' problem. We solved the problem using 'BruteForce' and 'BFS Search'.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-14502%eb%b2%88-%ec%97%b0%ea%b5%ac%ec%86%8c-c-baekjoon/35759/">백준 14502번 (연구소, 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-827569d8      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">연구소</h1>



<p><a href="https://www.acmicpc.net/problem/14502" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/14502</a></p>



<div style="height:62px" 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">메모리 제한</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">512 MB</td><td class="has-text-align-left" data-align="left">83491</td><td class="has-text-align-left" data-align="left">47994</td><td class="has-text-align-left" data-align="left">26670</td><td class="has-text-align-left" data-align="left">54.824%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>인체에 치명적인 바이러스를 연구하던 연구소에서 바이러스가 유출되었다. </p>



<p>다행히 바이러스는 아직 퍼지지 않았고, 바이러스의 확산을 막기 위해서 연구소에 벽을 세우려고 한다.</p>



<p>연구소는 크기가 N×M인 직사각형으로 나타낼 수 있으며, 직사각형은 1×1 크기의 정사각형으로 나누어져 있다. </p>



<p>연구소는 빈 칸, 벽으로 이루어져 있으며, 벽은 칸 하나를 가득 차지한다. </p>



<p>일부 칸은 바이러스가 존재하며, 이 바이러스는 상하좌우로 인접한 빈 칸으로 모두 퍼져나갈 수 있다. </p>



<p>새로 세울 수 있는 벽의 개수는 3개이며, 꼭 3개를 세워야 한다.</p>



<p>예를 들어, 아래와 같이 연구소가 생긴 경우를 살펴보자.</p>



<div style="height:20px" 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="">2 0 0 0 1 1 0
0 0 1 0 1 2 0
0 1 1 0 1 0 0
0 1 0 0 0 0 0
0 0 0 0 0 1 1
0 1 0 0 0 0 0
0 1 0 0 0 0 0</pre>



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



<p>이때, 0은 빈 칸, 1은 벽, 2는 바이러스가 있는 곳이다. 아무런 벽을 세우지 않는다면, 바이러스는 모든 빈 칸으로 퍼져나갈 수 있다.</p>



<p>2행 1열, 1행 2열, 4행 6열에 벽을 세운다면 지도의 모양은 아래와 같아지게 된다.</p>



<div style="height:20px" 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="">2 1 0 0 1 1 0
1 0 1 0 1 2 0
0 1 1 0 1 0 0
0 1 0 0 0 1 0
0 0 0 0 0 1 1
0 1 0 0 0 0 0
0 1 0 0 0 0 0</pre>



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



<p>바이러스가 퍼진 뒤의 모습은 아래와 같아진다.</p>



<div style="height:20px" 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="">2 1 0 0 1 1 2
1 0 1 0 1 2 2
0 1 1 0 1 2 2
0 1 0 0 0 1 2
0 0 0 0 0 1 1
0 1 0 0 0 0 0
0 1 0 0 0 0 0</pre>



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



<p>벽을 3개 세운 뒤, 바이러스가 퍼질 수 없는 곳을 안전 영역이라고 한다. </p>



<p>위의 지도에서 안전 영역의 크기는 27이다.</p>



<p>연구소의 지도가 주어졌을 때 얻을 수 있는 안전 영역 크기의 최댓값을 구하는 프로그램을 작성하시오.</p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫째 줄에 지도의 세로 크기 N과 가로 크기 M이 주어진다. (3 ≤ N, M ≤ 8)</p>



<p>둘째 줄부터 N개의 줄에 지도의 모양이 주어진다. </p>



<p>0은 빈 칸, 1은 벽, 2는 바이러스가 있는 위치이다. </p>



<p>2의 개수는 2보다 크거나 같고, 10보다 작거나 같은 자연수이다.</p>



<p>빈 칸의 개수는 3개 이상이다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>첫째 줄에 얻을 수 있는 안전 영역의 최대 크기를 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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="">7 7
2 0 0 0 1 1 0
0 0 1 0 1 2 0
0 1 1 0 1 0 0
0 1 0 0 0 0 0
0 0 0 0 0 1 1
0 1 0 0 0 0 0
0 1 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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="">27</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 2</h3>



<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 6
0 0 0 0 0 0
1 0 0 0 0 2
1 1 1 0 0 2
0 0 0 0 0 2</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 2</h3>



<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="">9</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 3</h3>



<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="">8 8
2 0 0 0 0 0 0 2
2 0 0 0 0 0 0 2
2 0 0 0 0 0 0 2
2 0 0 0 0 0 0 2
2 0 0 0 0 0 0 2
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 3</h3>



<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:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<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/bupjae" target="_blank" rel="noreferrer noopener">bupjae</a>, <a href="https://www.acmicpc.net/user/dotorya" target="_blank" rel="noreferrer noopener">dotorya</a></li>



<li>데이터를 추가한 사람: <a href="https://www.acmicpc.net/user/raboribus" target="_blank" rel="noreferrer noopener">raboribus</a></li>
</ul>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



<ul class="wp-block-list">
<li><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/7" target="_blank" rel="noreferrer noopener">그래프 이론</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/125" target="_blank" rel="noreferrer noopener">브루트포스 알고리즘</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/11" target="_blank" rel="noreferrer noopener">그래프 탐색</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/126" 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)"/>



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



<p>N과 M의 범위 (3 ≤ N, M ≤ 8) 와 주어진 시간을 보고 Brute Force 를 사용해도 된다고 생각했다.</p>



<p>모든 칸이 빈칸이라는 가정 하에 나올 수 있는 경우의 수는 64 * 63 * 62 (순열) = 249,984 이므로 주어진 시간내에 연산이 가능할 것이다.</p>



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



<p>바이러스가 퍼지는 것은 BFS 탐색으로 구현하여 탐색이 끝난 후 남은 빈 공간의 개수를 확인하는 방법으로 진행하였다. </p>



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



<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;vector>
#include &lt;queue>
using namespace std;
int _N, _M, _MapArr[8][8], _Res = 0, _Temp, _BlankCnt;
// 상, 하, 좌, 우 탐색
int _DxDy[4][2] = { {1,0}, {-1,0}, {0,1}, {0,-1} };
vector&lt;pair&lt;int, int>> _BlankV; // 빈공간의 좌표를 담는 벡터
vector&lt;pair&lt;int, int>> _VirusV; // 바이러스의 좌표를 담는 벡터
queue&lt;pair&lt;int, int>> _MyQueue; // BFS 탐색을 위한 큐
vector&lt;pair&lt;int, int>> _TVirusV; // BFS 탐색 후 맵 초기화를 위한 벡터

int BFS_Search()
{
	// 벽 3개는 무조건 만들어야 한다.
	int _blankCnt = _BlankCnt - 3;
	_TVirusV.clear();
	for (auto&amp; it : _VirusV) 
		_MyQueue.push(it);
	pair&lt;int, int> _CntPos;
	while (!_MyQueue.empty()) {
		_CntPos = _MyQueue.front();
		_MyQueue.pop();
		for (int i = 0; i &lt; 4; i++) {
			int _dx = _CntPos.first + _DxDy[i][0];
			int _dy = _CntPos.second + _DxDy[i][1];
			// 범위를 벗어남
			if (_dx >= _N || _dx &lt; 0 || _dy >= _M || _dy &lt; 0) continue;
			if (_MapArr[_dx][_dy] != 0) continue;
			_MapArr[_dx][_dy] = 2;
			_blankCnt--;
			_TVirusV.push_back(make_pair(_dx, _dy));
			_MyQueue.push(make_pair(_dx,_dy));
		}
	}
	for (auto&amp; it : _TVirusV) // 다음 탐색을 위해서 맵을 초기화
		_MapArr[it.first][it.second] = 0;
	return _blankCnt;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> _N >> _M;
	for (int i = 0; i &lt; _N; i++) 
		for (int j = 0; j &lt; _M; j++) {
			cin >> _Temp;
			if (_Temp == 0) // 빈 공간의 초기 좌표를 담는다
				_BlankV.push_back(make_pair(i, j));
			else if (_Temp == 2) // 바이러스의 초기 좌표를 담는다
				_VirusV.push_back(make_pair(i, j));
			_MapArr[i][j] = _Temp;
		}
	// 초기 빈공간의 개수를 카운팅
	_BlankCnt = _BlankV.size();
	// 순열 조합을 위한 3중 For문
	for (int i = 0; i &lt; _BlankCnt; i++) {
		_MapArr[_BlankV[i].first][_BlankV[i].second] = 1;
		for (int j = i + 1; j &lt; _BlankCnt; j++) {
			_MapArr[_BlankV[j].first][_BlankV[j].second] = 1;
			for (int k = j + 1; k &lt; _BlankCnt; k++) {
				_MapArr[_BlankV[k].first][_BlankV[k].second] = 1;
				// BruteForce 
				// 벽을 추가 할 수 있는 모든 경우의 수를 확인
				_Temp = BFS_Search();
				if (_Temp > _Res)
					_Res = _Temp;
				_MapArr[_BlankV[k].first][_BlankV[k].second] = 0;
			}
			_MapArr[_BlankV[j].first][_BlankV[j].second] = 0;
		}
		_MapArr[_BlankV[i].first][_BlankV[i].second] = 0;
	}
	
	cout &lt;&lt; _Res;
	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="1207" height="99" src="https://lycos7560.com/wp-content/uploads/2023/07/image-16.png" alt="" class="wp-image-35771" srcset="https://lycos7560.com/wp-content/uploads/2023/07/image-16.png 1207w, https://lycos7560.com/wp-content/uploads/2023/07/image-16-300x25.png 300w, https://lycos7560.com/wp-content/uploads/2023/07/image-16-768x63.png 768w" sizes="(max-width: 1207px) 100vw, 1207px" /></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></p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-14502%eb%b2%88-%ec%97%b0%ea%b5%ac%ec%86%8c-c-baekjoon/35759/">백준 14502번 (연구소, 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-14502%eb%b2%88-%ec%97%b0%ea%b5%ac%ec%86%8c-c-baekjoon/35759/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2587번 (대표값2, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2587%eb%b2%88-%eb%8c%80%ed%91%9c%ea%b0%922-c-baekjoon/35752/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2587%eb%b2%88-%eb%8c%80%ed%91%9c%ea%b0%922-c-baekjoon/35752/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 07 Jul 2023 21:13:56 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2587]]></category>
		<category><![CDATA[2587번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구현]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[대표값2]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 2587]]></category>
		<category><![CDATA[백준 2587번]]></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=35752</guid>

					<description><![CDATA[<p>백준 2587번 '대표값2' 문제에 대한글입니다.  (This is an article about Baekjoon Number 2587 'Representative Value 2'.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2587%eb%b2%88-%eb%8c%80%ed%91%9c%ea%b0%922-c-baekjoon/35752/">백준 2587번 (대표값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-8b0bfb40      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">대표값2</h1>



<p><a href="https://www.acmicpc.net/problem/2587" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2587</a></p>



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



<figure class="wp-block-table"><table><thead><tr><th>시간 제한</th><th>메모리 제한</th><th>제출</th><th>정답</th><th>맞힌 사람</th><th>정답 비율</th></tr></thead><tbody><tr><td>1 초</td><td>128 MB</td><td>31241</td><td>19249</td><td>17720</td><td>62.379%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>어떤 수들이 있을 때, 그 수들을 대표하는 값으로 가장 흔하게 쓰이는 것은 평균이다. </p>



<p>평균은 주어진 모든 수의 합을 수의 개수로 나눈 것이다. </p>



<p>예를 들어 10, 40, 30, 60, 30의 평균은 (10 + 40 + 30 + 60 + 30) / 5 = 170 / 5 = 34가 된다.</p>



<p>평균 이외의 또 다른 대표값으로 중앙값이라는 것이 있다. </p>



<p>중앙값은 주어진 수를 크기 순서대로 늘어 놓았을 때 가장 중앙에 놓인 값이다. </p>



<p>예를 들어 10, 40, 30, 60, 30의 경우, 크기 순서대로 늘어 놓으면</p>



<p>10 30 30 40 60</p>



<p>이 되고 따라서 중앙값은 30이 된다.</p>



<p>다섯 개의 자연수가 주어질 때 이들의 평균과 중앙값을 구하는 프로그램을 작성하시오.</p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫째 줄부터 다섯 번째 줄까지 한 줄에 하나씩 자연수가 주어진다. </p>



<p>주어지는 자연수는 100 보다 작은 10의 배수이다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>첫째 줄에는 평균을 출력하고, 둘째 줄에는 중앙값을 출력한다. </p>



<p>평균과 중앙값은 모두 자연수이다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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
40
30
60
30</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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="">34
30</pre>



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



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<p><a href="https://www.acmicpc.net/category/2" target="_blank" rel="noreferrer noopener">Olympiad</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/55" target="_blank" rel="noreferrer noopener">한국정보올림피아드</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/57" target="_blank" rel="noreferrer noopener">한국정보올림피아드시․도지역본선</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/72" target="_blank" rel="noreferrer noopener">지역본선 2005</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/detail/373" target="_blank" rel="noreferrer noopener">초등부</a>&nbsp;1번</p>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



<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/102" target="_blank" rel="noreferrer noopener">구</a><a href="https://www.acmicpc.net/problem/tag/102">현</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/97">정렬</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/121" 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)"/>



<h2 class="wp-block-heading has-large-font-size">통과된 코드</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>

using namespace std;

int _Arr[6], _Sum;

int main()
{
	for (int i = 0; i &lt; 5; i++)
		cin >> _Arr[i];
	// 배열의 크기가 작아서 선택 정렬을 사용
	for (int i = 0; i &lt; 5; i++)
		for (int j = 0; j &lt; 5; j++) {
			if (i == j) continue;
			if (_Arr[i] > _Arr[j]) {
				_Arr[5] = _Arr[i];
				_Arr[i] = _Arr[j];
				_Arr[j] = _Arr[5];
			}
		}
	for (int i = 0; i &lt; 5; i++)
		_Sum += _Arr[i];
	cout &lt;&lt; (int)(_Sum / 5) &lt;&lt; "\n";
	cout &lt;&lt; _Arr[2];

	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="1205" height="99" src="https://lycos7560.com/wp-content/uploads/2023/07/image-15.png" alt="" class="wp-image-35755" srcset="https://lycos7560.com/wp-content/uploads/2023/07/image-15.png 1205w, https://lycos7560.com/wp-content/uploads/2023/07/image-15-300x25.png 300w, https://lycos7560.com/wp-content/uploads/2023/07/image-15-768x63.png 768w" sizes="(max-width: 1205px) 100vw, 1205px" /></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-2587%eb%b2%88-%eb%8c%80%ed%91%9c%ea%b0%922-c-baekjoon/35752/">백준 2587번 (대표값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-2587%eb%b2%88-%eb%8c%80%ed%91%9c%ea%b0%922-c-baekjoon/35752/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2774번 (아름다운 수, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2774%eb%b2%88-%ec%95%84%eb%a6%84%eb%8b%a4%ec%9a%b4-%ec%88%98-c-baekjoon/35622/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2774%eb%b2%88-%ec%95%84%eb%a6%84%eb%8b%a4%ec%9a%b4-%ec%88%98-c-baekjoon/35622/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 02 Jul 2023 13:42:59 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2774]]></category>
		<category><![CDATA[2774번]]></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[백준 2774]]></category>
		<category><![CDATA[백준 2774번]]></category>
		<category><![CDATA[아름다운 수]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=35622</guid>

					<description><![CDATA[<p>백준 2774번 '아름다운 수' 문제에 대한 글입니다. 단순한 구현 문제입니다. (This article is about Baekjoon Number 2774 'Beautiful Sue' problem. It's a simple implementation problem.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2774%eb%b2%88-%ec%95%84%eb%a6%84%eb%8b%a4%ec%9a%b4-%ec%88%98-c-baekjoon/35622/">백준 2774번 (아름다운 수, 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-764b82f0      "
					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><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></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/2774" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2774</a></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">메모리 제한</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">128 MB</td><td class="has-text-align-left" data-align="left">3796</td><td class="has-text-align-left" data-align="left">2635</td><td class="has-text-align-left" data-align="left">2421</td><td class="has-text-align-left" data-align="left">71.521%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>윤정이는 뭐든지 아름다운 것이 좋다고 생각한다. </p>



<p>그래서 윤정이는 사물을 볼 때 자신이 정한 방법으로 아름다운 정도를 평가한다. </p>



<p>윤정이는 수를 볼 때도 이런 아름다운 수의 정도를 따지는데, </p>



<p>윤정이에게 있어서 아름다운 수의 정도는 그 수를 이루고 있는 10진수의 서로 다른 숫자의 개수를 의미한다.  </p>



<p>예를 들어 122이라는 수는 1과 2 라는 2개의 숫자로 이루어져 있으므로 아름다운 정도가 2가 된다. </p>



<p>윤정이의 방법으로 여러 수들의 아름다운 정도를 알아보자.</p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫째 줄에는 테스트 케이스의 개수 T가 주어진다. </p>



<p>다음 줄부터는 아름다운 정도를 알고 싶은 수 X(1 ≤ X ≤ 1000000000)가 주어진다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>각각의 테스트 케이스마다 X의 아름다운 정도를 한 줄에 하나씩 입력으로 주어진 순서대로 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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
7
122</pre>



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



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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
2</pre>



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



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<ul class="wp-block-list">
<li>어색한 표현을 찾은 사람: <a href="https://www.acmicpc.net/user/djm03178" target="_blank" rel="noreferrer noopener">djm03178</a></li>



<li>잘못된 데이터를 찾은 사람: <a href="https://www.acmicpc.net/user/kookmin20103324" target="_blank" rel="noreferrer noopener">kookmin20103324</a></li>
</ul>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/102" 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)"/>



<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>
using namespace std;
int _N, _Res, _Number;
bool _BoolArr[10];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> _N;
	for (int i = 0; i &lt; _N; i++) {
		for (int j = 0; j &lt; 10; j++)
			_BoolArr[j] = false;
		cin >> _Number;
		_Res = 0;
		while (_Number != 0) {
			_BoolArr[_Number % 10] = true;
			_Number /= 10;
		}
		for (int j = 0; j &lt; 10; j++)
			if (_BoolArr[j])
				_Res++;
		cout &lt;&lt; _Res &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"><img decoding="async" width="982" height="95" src="https://lycos7560.com/wp-content/uploads/2023/07/image.png" alt="" class="wp-image-35624" srcset="https://lycos7560.com/wp-content/uploads/2023/07/image.png 982w, https://lycos7560.com/wp-content/uploads/2023/07/image-300x29.png 300w, https://lycos7560.com/wp-content/uploads/2023/07/image-768x74.png 768w" sizes="(max-width: 982px) 100vw, 982px" /></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-2774%eb%b2%88-%ec%95%84%eb%a6%84%eb%8b%a4%ec%9a%b4-%ec%88%98-c-baekjoon/35622/">백준 2774번 (아름다운 수, 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-2774%eb%b2%88-%ec%95%84%eb%a6%84%eb%8b%a4%ec%9a%b4-%ec%88%98-c-baekjoon/35622/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2443번 (별 찍기 &#8211; 6, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2443%eb%b2%88-%eb%b3%84-%ec%b0%8d%ea%b8%b0-6-c-baekjoon/36283/</link>
					<comments>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2443%eb%b2%88-%eb%b3%84-%ec%b0%8d%ea%b8%b0-6-c-baekjoon/36283/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sat, 01 Jul 2023 05:57:11 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2443]]></category>
		<category><![CDATA[2443번]]></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[백준 2443]]></category>
		<category><![CDATA[백준 2443번]]></category>
		<category><![CDATA[별 찍기 - 6]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=36283</guid>

					<description><![CDATA[<p>백준 2443번 '별 찍기' 문제에 대한 글입니다. 단순한 구현 문제 입니다. (This article is about Baekjun 2443's "Take a Star" problem. It's a simple implementation problem.)</p>
<p>The post <a href="https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2443%eb%b2%88-%eb%b3%84-%ec%b0%8d%ea%b8%b0-6-c-baekjoon/36283/">백준 2443번 (별 찍기 &#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-8be3d7ae      "
					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="#별-찍기-6" class="uagb-toc-link__trigger">별 찍기 &#8211; 6</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">별 찍기 &#8211; 6</h1>



<p><a href="https://www.acmicpc.net/problem/2443" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2443</a></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">메모리 제한</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">128 MB</td><td class="has-text-align-left" data-align="left">32999</td><td class="has-text-align-left" data-align="left">24483</td><td class="has-text-align-left" data-align="left">22463</td><td class="has-text-align-left" data-align="left">75.377%</td></tr></tbody></table></figure>



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



<h3 class="wp-block-heading has-large-font-size">문제</h3>



<p>첫째 줄에는 별 2×N-1개, 둘째 줄에는 별 2×N-3개, &#8230;, N번째 줄에는 별 1개를 찍는 문제</p>



<p>별은 가운데를 기준으로 대칭이어야 한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">입력</h3>



<p>첫째 줄에 N(1 ≤ N ≤ 100)이 주어진다.</p>



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



<h3 class="wp-block-heading has-large-font-size">출력</h3>



<p>첫째 줄부터 N번째 줄까지 차례대로 별을 출력한다.</p>



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



<h3 class="wp-block-heading has-large-font-size">예제 입력 1</h3>



<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:40px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading has-large-font-size">예제 출력 1</h3>



<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="">*********
 *******
  *****
   ***
    *</pre>



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



<h3 class="wp-block-heading has-large-font-size">출처</h3>



<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/youngminz" target="_blank" rel="noreferrer noopener">youngminz</a></li>
</ul>



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



<h3 class="wp-block-heading has-large-font-size">알고리즘 분류</h3>



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/102" 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)"/>



<h2 class="wp-block-heading has-large-font-size">통과된 코드</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;string>

using namespace std;

int _N;
string _Str;

int main()
{
	cin >> _N;
	for (int i = 2 * _N - 1; i > 0; i--)
		_Str.push_back('*');
	cout &lt;&lt; _Str &lt;&lt; "\n";
	for (int i = 0; i &lt; _N - 1; i++) {
		_Str[i] = ' ';
		_Str = _Str.substr(0, _Str.length() -1);
		cout &lt;&lt; _Str &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"><img decoding="async" width="1204" height="95" src="https://lycos7560.com/wp-content/uploads/2023/07/image-47.png" alt="" class="wp-image-36299" srcset="https://lycos7560.com/wp-content/uploads/2023/07/image-47.png 1204w, https://lycos7560.com/wp-content/uploads/2023/07/image-47-300x24.png 300w, https://lycos7560.com/wp-content/uploads/2023/07/image-47-768x61.png 768w" sizes="(max-width: 1204px) 100vw, 1204px" /></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/%eb%b0%b1%ec%a4%80-2443%eb%b2%88-%eb%b3%84-%ec%b0%8d%ea%b8%b0-6-c-baekjoon/36283/">백준 2443번 (별 찍기 &#8211; 6, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/%eb%b0%b1%ec%a4%80-2443%eb%b2%88-%eb%b3%84-%ec%b0%8d%ea%b8%b0-6-c-baekjoon/36283/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
