<?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>EOF Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/eof/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Fri, 15 Mar 2024 15:51:56 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>EOF Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>백준 5639번 (이진 검색 트리, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-5639%eb%b2%88-%ec%9d%b4%ec%a7%84-%ea%b2%80%ec%83%89-%ed%8a%b8%eb%a6%ac-c-baekjoon/36556/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-5639%eb%b2%88-%ec%9d%b4%ec%a7%84-%ea%b2%80%ec%83%89-%ed%8a%b8%eb%a6%ac-c-baekjoon/36556/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 23 Aug 2023 04:20:19 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[5639]]></category>
		<category><![CDATA[5639번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[endoffile]]></category>
		<category><![CDATA[EOF]]></category>
		<category><![CDATA[Gold]]></category>
		<category><![CDATA[Gold5]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[골드]]></category>
		<category><![CDATA[골드5]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[그래프]]></category>
		<category><![CDATA[그래프 이론]]></category>
		<category><![CDATA[그래프 탐색]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 5639]]></category>
		<category><![CDATA[백준 5639번]]></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=36556</guid>

					<description><![CDATA[<p>백준 온라인 저지 5639번 문제 '이진 검색 트리' 에 대한 글입니다. 단순한 재귀를 이용하여 해결하였습니다. (Baekjoon Online Judge Number 5639 This article is about the binary search tree. It was solved using simple recursion.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-5639%eb%b2%88-%ec%9d%b4%ec%a7%84-%ea%b2%80%ec%83%89-%ed%8a%b8%eb%a6%ac-c-baekjoon/36556/">백준 5639번 (이진 검색 트리, 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-37922" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Gold_5-1.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Gold_5-1.jpg 1250w, https://lycos7560.com/wp-content/uploads/2024/03/Gold_5-1-234x300.jpg 234w, https://lycos7560.com/wp-content/uploads/2024/03/Gold_5-1-768x983.jpg 768w, https://lycos7560.com/wp-content/uploads/2024/03/Gold_5-1-1200x1536.jpg 1200w" sizes="(max-width: 30px) 100vw, 30px" /></h1>



<p class="wp-block-paragraph"><a href="https://www.acmicpc.net/problem/5639" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/5639</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">35442</td><td class="has-text-align-left" data-align="left">13888</td><td class="has-text-align-left" data-align="left">9821</td><td class="has-text-align-left" data-align="left">38.260%</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 class="wp-block-paragraph">이진 검색 트리는 다음과 같은 세 가지 조건을 만족하는 이진 트리이다.</p>



<ul class="wp-block-list">
<li>노드의 왼쪽 서브트리에 있는 모든 노드의 키는 노드의 키보다 작다.</li>



<li>노드의 오른쪽 서브트리에 있는 모든 노드의 키는 노드의 키보다 크다.</li>



<li>왼쪽, 오른쪽 서브트리도 이진 검색 트리이다.</li>
</ul>



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



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="677" height="315" src="https://lycos7560.com/wp-content/uploads/2023/08/image-17.png" alt="" class="wp-image-36557" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-17.png 677w, https://lycos7560.com/wp-content/uploads/2023/08/image-17-300x140.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></figure>



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



<p class="wp-block-paragraph">전위 순회 (루트-왼쪽-오른쪽)은 루트를 방문하고, 왼쪽 서브트리, 오른쪽 서브 트리를 순서대로 방문하면서 노드의 키를 출력한다. </p>



<p class="wp-block-paragraph">후위 순회 (왼쪽-오른쪽-루트)는 왼쪽 서브트리, 오른쪽 서브트리, 루트 노드 순서대로 키를 출력한다. </p>



<p class="wp-block-paragraph">예를 들어, 위의 이진 검색 트리의 전위 순회 결과는 50 30 24 5 28 45 98 52 60 이고, 후위 순회 결과는 5 28 24 45 30 60 52 98 50 이다.</p>



<p class="wp-block-paragraph">이진 검색 트리를 전위 순회한 결과가 주어졌을 때, 이 트리를 후위 순회한 결과를 구하는 프로그램을 작성하시오.</p>



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



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



<p class="wp-block-paragraph">트리를 전위 순회한 결과가 주어진다. </p>



<p class="wp-block-paragraph">노드에 들어있는 키의 값은 10<sup>6</sup>보다 작은 양의 정수이다. </p>



<p class="wp-block-paragraph">모든 값은 한 줄에 하나씩 주어지며, 노드의 수는 10,000개 이하이다. </p>



<p class="wp-block-paragraph">같은 키를 가지는 노드는 없다.</p>



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



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



<p class="wp-block-paragraph">입력으로 주어진 이진 검색 트리를 후위 순회한 결과를 한 줄에 하나씩 출력한다.</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="">50
30
24
5
28
45
98
52
60</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="">5
28
24
45
30
60
52
98
50</pre>



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



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



<p class="wp-block-paragraph"><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/42" target="_blank" rel="noreferrer noopener">Asia Pacific</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/102" target="_blank" rel="noreferrer noopener">Thailand</a>&nbsp;&gt;&nbsp;<a href="https://www.acmicpc.net/category/detail/562" target="_blank" rel="noreferrer noopener">2011 ACM-ICPC Asia Phuket Regional Programming Contest</a>&nbsp;B번</p>



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



<div style="height: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/7" 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/120" target="_blank" rel="noreferrer noopener">트리</a></li>



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

struct BinaryNode
{
    int _Num;
    BinaryNode* _Left;
    BinaryNode* _Right;

    BinaryNode(int num)
        : _Num(num), _Left(nullptr), _Right(nullptr)
    {}

    void ArrayBinaryNode(int _n)
    {
        if (_Num > _n) {
            if (_Left == nullptr) _Left = new BinaryNode(_n);
            else _Left->ArrayBinaryNode(_n);
        }
        else {
            if (_Right == nullptr) _Right = new BinaryNode(_n);
            else _Right->ArrayBinaryNode(_n);
        }
    }
};

void PostorderTraverse(BinaryNode&amp; CurrentNode)
{
    if (CurrentNode._Left != nullptr) PostorderTraverse(*CurrentNode._Left);
    if (CurrentNode._Right != nullptr) PostorderTraverse(*CurrentNode._Right);
    cout &lt;&lt; CurrentNode._Num &lt;&lt; "\n";
}


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

    int _N;
    cin >> _N;
    BinaryNode _RootNode(_N);
    while (true) {
        cin >> _N;
        if (cin.eof() == true)
            break;
        _RootNode.ArrayBinaryNode(_N);
    }

    PostorderTraverse(_RootNode);

	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="1076" height="98" src="https://lycos7560.com/wp-content/uploads/2023/08/image-18.png" alt="" class="wp-image-36561" style="width:927px;height:84px" srcset="https://lycos7560.com/wp-content/uploads/2023/08/image-18.png 1076w, https://lycos7560.com/wp-content/uploads/2023/08/image-18-300x27.png 300w, https://lycos7560.com/wp-content/uploads/2023/08/image-18-768x70.png 768w" sizes="(max-width: 1076px) 100vw, 1076px" /></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/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-5639%eb%b2%88-%ec%9d%b4%ec%a7%84-%ea%b2%80%ec%83%89-%ed%8a%b8%eb%a6%ac-c-baekjoon/36556/">백준 5639번 (이진 검색 트리, 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-5639%eb%b2%88-%ec%9d%b4%ec%a7%84-%ea%b2%80%ec%83%89-%ed%8a%b8%eb%a6%ac-c-baekjoon/36556/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 11718번 (그대로 출력하기, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11718%eb%b2%88-%ea%b7%b8%eb%8c%80%eb%a1%9c-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0-c-baekjoon/5937/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11718%eb%b2%88-%ea%b7%b8%eb%8c%80%eb%a1%9c-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0-c-baekjoon/5937/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 01 Feb 2023 03:35:13 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[11718]]></category>
		<category><![CDATA[11718번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cin.tie(NULL)]]></category>
		<category><![CDATA[cout.tie(NULL)]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[endoffile]]></category>
		<category><![CDATA[EOF]]></category>
		<category><![CDATA[getline]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false)]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false);]]></category>
		<category><![CDATA[std]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구현]]></category>
		<category><![CDATA[그대로 출력하기]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[문자열]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 11718]]></category>
		<category><![CDATA[백준 11718번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=5937</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 11718번 '그대로 출력하기' 문제에 대한 글입니다. (This article is about the problem of 'printing as it is' in BAEKJOON 11718.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11718%eb%b2%88-%ea%b7%b8%eb%8c%80%eb%a1%9c-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0-c-baekjoon/5937/">백준 11718번 (그대로 출력하기, 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-f290c8f8      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#그대로-출력하기" class="uagb-toc-link__trigger">그대로 출력하기</a><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">그대로 출력하기</h1>



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



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



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



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



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



<p class="has-medium-font-size wp-block-paragraph">입력 받은 대로 출력하는 프로그램을 작성하시오.</p>



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



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



<p class="has-medium-font-size wp-block-paragraph">입력이 주어진다. 입력은 최대 100줄로 이루어져 있고, </p>



<p class="has-medium-font-size wp-block-paragraph">알파벳 소문자, 대문자, 공백, 숫자로만 이루어져 있다. </p>



<p class="has-medium-font-size wp-block-paragraph">각 줄은 100글자를 넘지 않으며, 빈 줄은 주어지지 않는다. </p>



<p class="has-medium-font-size wp-block-paragraph">또, 각 줄은 공백으로 시작하지 않고, 공백으로 끝나지 않는다.</p>



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



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



<p class="has-medium-font-size wp-block-paragraph">입력받은 그대로 출력한다.</p>



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

using namespace std;

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

	string str;
	while (cin.eof() != true) { // EOF를 이용하여 검사

		getline(cin, str); // 라인을 string 으로 한번에 받는다. 

		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="1034" height="98" src="https://lycos7560.com/wp-content/uploads/2023/02/image-30.png" alt="" class="wp-image-5939" srcset="https://lycos7560.com/wp-content/uploads/2023/02/image-30.png 1034w, https://lycos7560.com/wp-content/uploads/2023/02/image-30-300x28.png 300w, https://lycos7560.com/wp-content/uploads/2023/02/image-30-768x73.png 768w" sizes="(max-width: 1034px) 100vw, 1034px" /></figure>



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



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5698326622209671" data-ad-slot="4245812909"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11718%eb%b2%88-%ea%b7%b8%eb%8c%80%eb%a1%9c-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0-c-baekjoon/5937/">백준 11718번 (그대로 출력하기, 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-11718%eb%b2%88-%ea%b7%b8%eb%8c%80%eb%a1%9c-%ec%b6%9c%eb%a0%a5%ed%95%98%ea%b8%b0-c-baekjoon/5937/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 10951번 (A+B &#8211; 4, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/10951-ab-4-c-baekjoon/4164/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/10951-ab-4-c-baekjoon/4164/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sat, 07 Jan 2023 16:11:32 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10951]]></category>
		<category><![CDATA[10951번]]></category>
		<category><![CDATA[A+ B -4]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[endoffile]]></category>
		<category><![CDATA[EOF]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10951]]></category>
		<category><![CDATA[백준 10951번]]></category>
		<category><![CDATA[수학]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4164</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 10951번 'A+B - 4' 문제에 대한 글입니다.  문제의 포인트는 'EndofFile'을 처리하는데 있는 것 같습니다. (This is an article about the 'A+B-4' problem in BAEKJOON 10951. The point of the problem seems to be in dealing with 'End of File'.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/10951-ab-4-c-baekjoon/4164/">백준 10951번 (A+B &#8211; 4, 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:68px" aria-hidden="true" class="wp-block-spacer"></div>



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



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



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



<figure id="problem-info" class="wp-block-table"><table><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">286357</td><td class="has-text-align-left" data-align="left">101857</td><td class="has-text-align-left" data-align="left">85660</td><td class="has-text-align-left" data-align="left">35.661%</td></tr></tbody></table></figure>



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



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



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



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



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



<p class="has-medium-font-size wp-block-paragraph">입력은 여러 개의 테스트 케이스로 이루어져 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 &lt; A, B &lt; 10)</p>



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



<div style="height:53px" 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)"/>



<figure class="wp-block-embed is-type-wp-embed is-provider-어제와-내일의-나-그-사이의-이야기 wp-block-embed-어제와-내일의-나-그-사이의-이야기"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="OO59frn4xV"><a href="https://lycos7560.com/?p=4132">백준 10952번 (A+B &#8211; 5, C++) [BAEKJOON]</a></blockquote><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;백준 10952번 (A+B &#8211; 5, C++) [BAEKJOON]&#8221; &#8212; 어제와 내일의 나 그 사이의 이야기" src="https://lycos7560.com/?p=4132&#038;embed=true#?secret=JENTZPzS8i#?secret=OO59frn4xV" data-secret="OO59frn4xV" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



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



<p class="has-medium-font-size wp-block-paragraph">백준 10952번 문제와 90% 정도 같지만 입력에서 큰 차이가 있다.</p>



<p class="has-medium-font-size wp-block-paragraph">10952번은 0 0 을 입력으로 주면서 입력의 마지막을 알려주었다면 이 문제에서는 그런 것이 없다.</p>



<p class="has-medium-font-size wp-block-paragraph">이 문제를 해결하려면 EOF 에 대하여 알아야 한다.</p>



<p class="has-medium-font-size wp-block-paragraph">EOF &#8211; End of File의 약자로 텍스트 파일의 끝을 알리기 위한 문자 값이다.</p>



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



<p class="has-medium-font-size wp-block-paragraph"><a href="https://lollolzkk.tistory.com/15" target="_blank" rel="noreferrer noopener">https://lollolzkk.tistory.com/15</a></p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1153" height="690" src="https://lycos7560.com/wp-content/uploads/image-858.png" alt="" class="wp-image-4165" srcset="https://lycos7560.com/wp-content/uploads/image-858.png 1153w, https://lycos7560.com/wp-content/uploads/image-858-300x180.png 300w, https://lycos7560.com/wp-content/uploads/image-858-768x460.png 768w" sizes="(max-width: 1153px) 100vw, 1153px" /></figure>



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



<p class="has-medium-font-size wp-block-paragraph">파일의 끝이라면 cin.eof()는 true 값을 반환한다는 것만 알고 있으면 된다.</p>



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



<p class="has-medium-font-size wp-block-paragraph">코드를 작성할때 10952번 코드를 재활용해서 bool 값으로 pair값의 first, second를 구별하여 넣어주었다. </p>



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



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



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



<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>
#include &lt;list>

using namespace std;

list &lt;pair&lt;int, int>> tempList;
list &lt;pair&lt;int, int>>::iterator it;

pair&lt;int, int> temp;

int main()
{
    bool check = true;
    while (!cin.eof()) {
        if (check) { 
            cin >> temp.first; 
            check = !check;
        }
        else {
            cin >> temp.second;
            check = !check;
            tempList.push_back(temp);
        }
    }

    for (it = tempList.begin(); it != tempList.end(); it++)
        cout &lt;&lt; it->first + it->second &lt;&lt; "\n";

    return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1033" height="95" src="https://lycos7560.com/wp-content/uploads/image-859.png" alt="" class="wp-image-4166" srcset="https://lycos7560.com/wp-content/uploads/image-859.png 1033w, https://lycos7560.com/wp-content/uploads/image-859-300x28.png 300w, https://lycos7560.com/wp-content/uploads/image-859-768x71.png 768w" sizes="(max-width: 1033px) 100vw, 1033px" /></figure>



<div style="height:52px" 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/10951-ab-4-c-baekjoon/4164/">백준 10951번 (A+B &#8211; 4, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/10951-ab-4-c-baekjoon/4164/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
