<?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/%EC%A0%90%ED%99%94%EC%8B%9D/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Thu, 23 Feb 2023 00:11:42 +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>백준 2579번 (계단 오르기, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2579%eb%b2%88-%ea%b3%84%eb%8b%a8-%ec%98%a4%eb%a5%b4%ea%b8%b0-c-dp-baekjoon/5167/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2579%eb%b2%88-%ea%b3%84%eb%8b%a8-%ec%98%a4%eb%a5%b4%ea%b8%b0-c-dp-baekjoon/5167/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Fri, 20 Jan 2023 23:06:35 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2579]]></category>
		<category><![CDATA[2579번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></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[백준 2579]]></category>
		<category><![CDATA[백준 2579번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=5167</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 2579번 '계단 오르기' 문제에 대한 글입니다. 'DP'를 이용하여 해결하였습니다. (This is BAEKJOON's article on the question of 'climbing stairs' No. 2579. Resolved using 'DP'.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2579%eb%b2%88-%ea%b3%84%eb%8b%a8-%ec%98%a4%eb%a5%b4%ea%b8%b0-c-dp-baekjoon/5167/">백준 2579번 (계단 오르기, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



<h1 class="wp-block-heading">계단 오르기</h1>



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/2579" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2579</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">128 MB</td><td class="has-text-align-left" data-align="left">143346</td><td class="has-text-align-left" data-align="left">48944</td><td class="has-text-align-left" data-align="left">35360</td><td class="has-text-align-left" data-align="left">33.778%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">계단 오르기 게임은 계단 아래 시작점부터 계단 꼭대기에 위치한 도착점까지 가는 게임이다. </p>



<p class="has-medium-font-size">&lt;그림 1>과 같이 각각의 계단에는 일정한 점수가 쓰여 있는데 계단을 밟으면 그 계단에 쓰여 있는 점수를 얻게 된다.</p>



<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="607" height="410" src="https://lycos7560.com/wp-content/uploads/image-1018.png" alt="" class="wp-image-5168" srcset="https://lycos7560.com/wp-content/uploads/image-1018.png 607w, https://lycos7560.com/wp-content/uploads/image-1018-300x203.png 300w" sizes="(max-width: 607px) 100vw, 607px" /></figure>



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



<p class="has-medium-font-size">예를 들어 &lt;그림 2>와 같이 시작점에서부터 </p>



<p class="has-medium-font-size">첫 번째, 두 번째, 네 번째, 여섯 번째 계단을 밟아 도착점에 도달하면 총 점수는 10 + 20 + 25 + 20 = 75점이 된다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="657" height="428" src="https://lycos7560.com/wp-content/uploads/image-1019.png" alt="" class="wp-image-5169" srcset="https://lycos7560.com/wp-content/uploads/image-1019.png 657w, https://lycos7560.com/wp-content/uploads/image-1019-300x195.png 300w" sizes="(max-width: 657px) 100vw, 657px" /></figure>



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



<p class="has-medium-font-size">계단 오르는 데는 다음과 같은 규칙이 있다.</p>



<p class="has-medium-font-size">1. 계단은 한 번에 한 계단씩 또는 두 계단씩 오를 수 있다. 즉, 한 계단을 밟으면서 이어서 다음 계단이나, 다음 다음 계단으로 오를 수 있다.</p>



<p class="has-medium-font-size">2. 연속된 세 개의 계단을 모두 밟아서는 안 된다. 단, 시작점은 계단에 포함되지 않는다.</p>



<p class="has-medium-font-size">3. 마지막 도착 계단은 반드시 밟아야 한다.</p>



<p class="has-medium-font-size">따라서 첫 번째 계단을 밟고 이어 두 번째 계단이나, 세 번째 계단으로 오를 수 있다. </p>



<p class="has-medium-font-size">하지만, 첫 번째 계단을 밟고 이어 네 번째 계단으로 올라가거나, 첫 번째, 두 번째, 세 번째 계단을 연속해서 모두 밟을 수는 없다.</p>



<p class="has-medium-font-size">각 계단에 쓰여 있는 점수가 주어질 때 이 게임에서 얻을 수 있는 총 점수의 최댓값을 구하는 프로그램을 작성하시오.</p>



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



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



<p class="has-medium-font-size">입력의 첫째 줄에 계단의 개수가 주어진다.</p>



<p class="has-medium-font-size">둘째 줄부터 한 줄에 하나씩 제일 아래에 놓인 계단부터 순서대로 각 계단에 쓰여 있는 점수가 주어진다. </p>



<p class="has-medium-font-size">계단의 개수는 300이하의 자연수이고, 계단에 쓰여 있는 점수는 10,000이하의 자연수이다.</p>



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



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



<p class="has-medium-font-size">첫째 줄에 계단 오르기 게임에서 얻을 수 있는 총 점수의 최댓값을 출력한다.</p>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">6
10
20
15
25
10
20</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="">75</pre>



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



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



<p><a href="https://www.acmicpc.net/category/2" target="_blank" rel="noreferrer noopener">Olympiad</a> > <a href="https://www.acmicpc.net/category/55" target="_blank" rel="noreferrer noopener">한국정보올림피아드</a> > <a href="https://www.acmicpc.net/category/57" target="_blank" rel="noreferrer noopener">한국정보올림피아드시․도지역본선</a> > <a href="https://www.acmicpc.net/category/70" target="_blank" rel="noreferrer noopener">지역본선 2006</a> > <a href="https://www.acmicpc.net/category/detail/367" target="_blank" rel="noreferrer noopener">초등부</a> 4번</p>



<ul class="wp-block-list">
<li>문제의 오타를 찾은 사람: <a href="https://www.acmicpc.net/user/cjswodmlskfk" target="_blank" rel="noreferrer noopener">cjswodmlskfk</a>, <a href="https://www.acmicpc.net/user/eric00513" target="_blank" rel="noreferrer noopener">eric00513</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/25" 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)"/>



<p class="has-medium-font-size">점화식을 찾는데 생각보다 시간을 많이 소모한 문제</p>



<p class="has-medium-font-size">연속된 3개의 계단이 안된다는 조건을 잘 해결해야 쉽게 풀린다.</p>



<p class="has-medium-font-size">arr[N]이 N번째 계단에서의 가장 높은 가치인 경우를 나타낸다.</p>



<p class="has-medium-font-size">=> arr[ ] + arr[ ] 이런 점화식을 만들면 DP 전체가 무너진다. (이런 잘못된 생각으로 시간을 엄청 날렸다.)</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1600" height="1049" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230121_074858551.jpg" alt="" class="wp-image-5170" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230121_074858551.jpg 1600w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230121_074858551-300x197.jpg 300w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230121_074858551-768x504.jpg 768w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230121_074858551-1536x1007.jpg 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /></figure>



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



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



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

// N : 계단의 개수
int N;

// value[N] = N번째 계단의 가치
int value[301];

// dp[N] = N번째 계단의 최고 가치
int arr[301];

int main()
{
	cin >> N;

	for (int i = 1; i &lt;= N; i++) cin >> value[i];

	// dp 값 초기화
	arr[0] = 0;
	arr[1] = value[1];
	arr[2] = value[2] + value[1];

	for (int j = 3; j &lt;= N; j++) {
		arr[j] = max(arr[j - 2] + value[j], arr[j - 3] + value[j] + value[j - 1]);
	}

	cout &lt;&lt; arr[N];

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1036" height="101" src="https://lycos7560.com/wp-content/uploads/image-1020.png" alt="" class="wp-image-5173" srcset="https://lycos7560.com/wp-content/uploads/image-1020.png 1036w, https://lycos7560.com/wp-content/uploads/image-1020-300x29.png 300w, https://lycos7560.com/wp-content/uploads/image-1020-768x75.png 768w" sizes="(max-width: 1036px) 100vw, 1036px" /></figure>



<div style="height:60px" 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-2579%eb%b2%88-%ea%b3%84%eb%8b%a8-%ec%98%a4%eb%a5%b4%ea%b8%b0-c-dp-baekjoon/5167/">백준 2579번 (계단 오르기, C++, DP) [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-2579%eb%b2%88-%ea%b3%84%eb%8b%a8-%ec%98%a4%eb%a5%b4%ea%b8%b0-c-dp-baekjoon/5167/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 1003번 (피보나치 함수, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/1003-fibonacci-function-c-dp-baekjoon/5030/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/1003-fibonacci-function-c-dp-baekjoon/5030/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Thu, 19 Jan 2023 21:16:26 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[fibonacci]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 1003]]></category>
		<category><![CDATA[백준 1003번]]></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=5030</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 1003번 '피보나치 함수' 문제에 대한 글입니다. 'DP' 알고리즘을 이용하여 해결하였습니다. (This is an article about the 'Fibonacci function' problem in BAEKJOON No. 1003. Solved using 'DP' algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/1003-fibonacci-function-c-dp-baekjoon/5030/">백준 1003번 (피보나치 함수, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



<h1 class="wp-block-heading">피보나치 함수</h1>



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



<div style="height:38px" 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">0.25 초 </td><td class="has-text-align-left" data-align="left">128 MB</td><td class="has-text-align-left" data-align="left">178348</td><td class="has-text-align-left" data-align="left">52048</td><td class="has-text-align-left" data-align="left">40832</td><td class="has-text-align-left" data-align="left">31.975%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">다음 소스는 N번째 피보나치 수를 구하는 C++ 함수이다.</p>



<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="">int fibonacci(int n) {
    if (n == 0) {
        printf("0");
        return 0;
    } else if (n == 1) {
        printf("1");
        return 1;
    } else {
        return fibonacci(n‐1) + fibonacci(n‐2);
    }
}</pre>



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



<p class="has-medium-font-size">fibonacci(3)을 호출하면 다음과 같은 일이 일어난다.</p>



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



<p class="has-medium-font-size">fibonacci(3)은 fibonacci(2)와 fibonacci(1) (첫 번째 호출)을 호출한다.</p>



<p class="has-medium-font-size">fibonacci(2)는 fibonacci(1) (두 번째 호출)과 fibonacci(0)을 호출한다.</p>



<p class="has-medium-font-size">두 번째 호출한 fibonacci(1)은 1을 출력하고 1을 리턴한다.</p>



<p class="has-medium-font-size">fibonacci(0)은 0을 출력하고, 0을 리턴한다.</p>



<p class="has-medium-font-size">fibonacci(2)는 fibonacci(1)과 fibonacci(0)의 결과를 얻고, 1을 리턴한다.</p>



<p class="has-medium-font-size">첫 번째 호출한 fibonacci(1)은 1을 출력하고, 1을 리턴한다.</p>



<p class="has-medium-font-size">fibonacci(3)은 fibonacci(2)와 fibonacci(1)의 결과를 얻고, 2를 리턴한다.</p>



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



<p class="has-medium-font-size">1은 2번 출력되고, 0은 1번 출력된다. N이 주어졌을 때, fibonacci(N)을 호출했을 때, </p>



<p class="has-medium-font-size">0과 1이 각각 몇 번 출력되는지 구하는 프로그램을 작성하시오.</p>



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



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



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



<p class="has-medium-font-size">각 테스트 케이스는 한 줄로 이루어져 있고, N이 주어진다. N은 40보다 작거나 같은 자연수 또는 0이다.</p>



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



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



<p class="has-medium-font-size">각 테스트 케이스마다 0이 출력되는 횟수와 1이 출력되는 횟수를 공백으로 구분해서 출력한다.</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="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">3
0
1
3</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="">1 0
0 1
1 2</pre>



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



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



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



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



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



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



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



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



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



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



<li>어색한 표현을 찾은 사람: <a href="https://www.acmicpc.net/user/cyj101366" target="_blank" rel="noreferrer noopener">cyj101366</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/25" 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>



<p class="has-medium-font-size">1 &#8211; 10 까지 확인</p>



<div style="height:30px" 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>

using namespace std;

int T, N, Zero, One;

int fibonacci(int n) {

	if (n == 0) {
		Zero++;
		return 0;
	} 
	else if (n == 1) {
		One++;
		return 1;
	}
	else return fibonacci(n - 1) + fibonacci(n - 2);
}

int main()
{
	cin >> T;
	for (int i = 0; i &lt; T; i++) {
		cin >> N;
		Zero = 0;
		One = 0;
		fibonacci(N);
		cout &lt;&lt; Zero &lt;&lt; " " &lt;&lt; One &lt;&lt; "\n";
	}

	return 0;
}</pre>



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



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://lycos7560.com/wp-content/uploads/image-996.png" alt="" class="wp-image-5031" width="186" height="507" srcset="https://lycos7560.com/wp-content/uploads/image-996.png 138w, https://lycos7560.com/wp-content/uploads/image-996-110x300.png 110w" sizes="(max-width: 186px) 100vw, 186px" /></figure>



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



<p class="has-medium-font-size"><strong>arrZero[0] = 1</strong>, arrZero[1] = 0, arrZero[2] = 1 / arrZero[N] = arrZero[N-1] + arrZero[N-2]</p>



<p class="has-medium-font-size">arrOne[0] = 0, arrOne[1] = 1, arrOne[2] = 1 / arrOne[N] = arrOne[N-1] + arrOne[N-2]  점화식을 발견</p>



<p class="has-medium-font-size"><strong>N = 0 일때 arrZero[0] 를 생각해야 한다. (생각을 못해 12%에서 틀렸습니다.)</strong></p>



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



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



<div style="height:30px" 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;

int T, N, Zero, One;

long long int arrZero[41] = {1, 0, 1}; // 초기화
long long int arrOne[41] = {0, 1, 1}; // 초기화

list&lt;int> myList;

int main()
{
	cin >> T;

	for (int i = 0; i &lt; T; i++) {
		cin >> N;
		myList.push_back(N);
	}

	for (auto it = myList.begin(); it != myList.end(); it++) {
		for (int i = 3; i &lt;= *it; i++) {
			if (arrZero[i] == 0) arrZero[i] = arrZero[i - 1] + arrZero[i - 2];
			if (arrOne[i] == 0) arrOne[i] = arrOne[i - 1] + arrOne[i - 2];
		}

		cout &lt;&lt; arrZero[*it] &lt;&lt; " " &lt;&lt; arrOne[*it] &lt;&lt; "\n";
	}

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1040" height="146" src="https://lycos7560.com/wp-content/uploads/image-997.png" alt="" class="wp-image-5037" srcset="https://lycos7560.com/wp-content/uploads/image-997.png 1040w, https://lycos7560.com/wp-content/uploads/image-997-300x42.png 300w, https://lycos7560.com/wp-content/uploads/image-997-768x108.png 768w" sizes="(max-width: 1040px) 100vw, 1040px" /></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/1003-fibonacci-function-c-dp-baekjoon/5030/">백준 1003번 (피보나치 함수, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/1003-fibonacci-function-c-dp-baekjoon/5030/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 11727번 (2×n 타일링 2, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11727%eb%b2%88-2xn-%ed%83%80%ec%9d%bc%eb%a7%81-2-c-dp-baekjoon/4870/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11727%eb%b2%88-2xn-%ed%83%80%ec%9d%bc%eb%a7%81-2-c-dp-baekjoon/4870/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 18 Jan 2023 03:33:23 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[11727]]></category>
		<category><![CDATA[11727번]]></category>
		<category><![CDATA[2×n 타일링 2]]></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[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false)]]></category>
		<category><![CDATA[ios_base::sync_with_stdio(false);]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[모듈러 산술]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 11727]]></category>
		<category><![CDATA[백준 11727번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[해결방법]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4870</guid>

					<description><![CDATA[<p>백준 11727번 "2×n 타일링 2" 문제에 대한 글입니다.  DP 알고리즘을 이용하여 해결하였습니다.</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-11727%eb%b2%88-2xn-%ed%83%80%ec%9d%bc%eb%a7%81-2-c-dp-baekjoon/4870/">백준 11727번 (2×n 타일링 2, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



<h1 class="wp-block-heading">2×n 타일링 2</h1>



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



<div style="height:27px" 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">56506</td><td class="has-text-align-left" data-align="left">33840</td><td class="has-text-align-left" data-align="left">27060</td><td class="has-text-align-left" data-align="left">59.291%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">2×n 직사각형을 1×2, 2×1과 2×2 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.</p>



<p class="has-medium-font-size">아래 그림은 2×17 직사각형을 채운 한가지 예이다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1152" height="236" src="https://lycos7560.com/wp-content/uploads/image-990.png" alt="" class="wp-image-4871" srcset="https://lycos7560.com/wp-content/uploads/image-990.png 1152w, https://lycos7560.com/wp-content/uploads/image-990-300x61.png 300w, https://lycos7560.com/wp-content/uploads/image-990-768x157.png 768w" sizes="(max-width: 1152px) 100vw, 1152px" /></figure>



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



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



<p class="has-medium-font-size">첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)</p>



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



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



<p class="has-medium-font-size">첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.</p>



<div style="height:37px" 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</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="">3</pre>



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



<figure class="wp-block-image size-full"><img decoding="async" width="1600" height="1706" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230118_121927876.jpg" alt="" class="wp-image-4872" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230118_121927876.jpg 1600w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230118_121927876-281x300.jpg 281w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230118_121927876-768x819.jpg 768w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230118_121927876-1441x1536.jpg 1441w" sizes="(max-width: 1600px) 100vw, 1600px" /></figure>



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



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



<div style="height:31px" 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>

using namespace std;

long long int arr[1001];

constexpr int MOD = 10007;

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

	cin >> arr[0];

	// DP 배열초기화
	arr[1] = 1;
	arr[2] = 3;

	for (int i = 3; i &lt;= arr[0]; i++) 	
		arr[i] = (arr[i - 1] % MOD + (arr[i - 2] * 2) % MOD) % MOD; // 모듈러 산술

	cout &lt;&lt; arr[arr[0]];

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1042" height="100" src="https://lycos7560.com/wp-content/uploads/image-991.png" alt="" class="wp-image-4873" srcset="https://lycos7560.com/wp-content/uploads/image-991.png 1042w, https://lycos7560.com/wp-content/uploads/image-991-300x29.png 300w, https://lycos7560.com/wp-content/uploads/image-991-768x74.png 768w" sizes="(max-width: 1042px) 100vw, 1042px" /></figure>



<div style="height:43px" 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-11727%eb%b2%88-2xn-%ed%83%80%ec%9d%bc%eb%a7%81-2-c-dp-baekjoon/4870/">백준 11727번 (2×n 타일링 2, C++, DP) [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-11727%eb%b2%88-2xn-%ed%83%80%ec%9d%bc%eb%a7%81-2-c-dp-baekjoon/4870/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 1463번 (1로 만들기, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/1463-making-it-one-c-dp-baekjoon/4739/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/1463-making-it-one-c-dp-baekjoon/4739/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 17 Jan 2023 03:12:52 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[1463]]></category>
		<category><![CDATA[1463번]]></category>
		<category><![CDATA[1로 만들기]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 1463]]></category>
		<category><![CDATA[백준 1463번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4739</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 1463번 '1로 만들기'  문제에 대한 글입니다.<br />
"DP" 알고리즘을 이용하여 해결하였습니다. (This is BAEKJOON's 1463 article on the question of 'making it one'.<br />
Solved using the "DP" algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/1463-making-it-one-c-dp-baekjoon/4739/">백준 1463번 (1로 만들기, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



<h1 class="wp-block-heading">1로 만들기</h1>



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



<div style="height:32px" 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">0.15 초</td><td class="has-text-align-left" data-align="left">128 MB</td><td class="has-text-align-left" data-align="left">235031</td><td class="has-text-align-left" data-align="left">77601</td><td class="has-text-align-left" data-align="left">49735</td><td class="has-text-align-left" data-align="left">32.333%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">정수 X에 사용할 수 있는 연산은 다음과 같이 세 가지 이다.</p>



<p>1. X가 3으로 나누어 떨어지면, 3으로 나눈다.</p>



<p>2. X가 2로 나누어 떨어지면, 2로 나눈다.</p>



<p>3. 1을 뺀다.</p>



<p class="has-medium-font-size">정수 N이 주어졌을 때,&nbsp;위와 같은 연산 세 개를 적절히 사용해서&nbsp;1을 만들려고 한다. </p>



<p class="has-medium-font-size">연산을 사용하는 횟수의 최솟값을 출력하시오.</p>



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



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



<p class="has-medium-font-size">첫째 줄에 1보다 크거나 같고, 10<sup>6</sup>보다 작거나 같은 정수 N이 주어진다.</p>



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



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



<p class="has-medium-font-size">첫째 줄에 연산을 하는 횟수의 최솟값을 출력한다.</p>



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



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



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



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



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



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



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



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



<h2 class="wp-block-heading">힌트</h2>



<p class="has-medium-font-size">10의 경우에 10 -&gt; 9 -&gt; 3 -&gt; 1 로 3번 만에 만들 수 있다.</p>



<div style="height:35px" 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>



<li>문제의 오타를 찾은 사람:&nbsp;<a href="https://www.acmicpc.net/user/cyj101366" target="_blank" rel="noreferrer noopener">cyj101366</a>,&nbsp;<a href="https://www.acmicpc.net/user/jugol" target="_blank" rel="noreferrer noopener">jugol</a></li>



<li>어색한 표현을 찾은 사람:&nbsp;<a href="https://www.acmicpc.net/user/dbfldkfdbgml" target="_blank" rel="noreferrer noopener">dbfldkfdbgml</a></li>



<li>데이터를 추가한 사람:&nbsp;<a href="https://www.acmicpc.net/user/dynamiseus" target="_blank" rel="noreferrer noopener">dynamiseus</a>,&nbsp;<a href="https://www.acmicpc.net/user/jooa7878" target="_blank" rel="noreferrer noopener">jooa7878</a>,&nbsp;<a href="https://www.acmicpc.net/user/lcr7324" target="_blank" rel="noreferrer noopener">lcr7324</a></li>
</ul>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1600" height="757" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_120808546.jpg" alt="" class="wp-image-4740" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_120808546.jpg 1600w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_120808546-300x142.jpg 300w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_120808546-768x363.jpg 768w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_120808546-1536x727.jpg 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /></figure>



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



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



<div style="height:31px" 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>

using namespace std;

int arr[1000001];

int main()
{
	cin >> arr[0];
	arr[2] = 1;
	arr[3] = 1;

	for (int i = 4; i &lt;= arr[0]; i++) {
		arr[1] = arr[i - 1] + 1;

		if (i % 2 == 0) arr[1] = min(arr[1], arr[i / 2] + 1);

		if (i % 3 == 0) arr[1] = min(arr[1], arr[i / 3] + 1);

		arr[i] = arr[1];
	}

	cout &lt;&lt; arr[arr[0]];
	return 0;
}</pre>



<div style="height:46px" 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/1463-making-it-one-c-dp-baekjoon/4739/">백준 1463번 (1로 만들기, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/1463-making-it-one-c-dp-baekjoon/4739/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 1904번 (01타일, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/1904-01tile-c-dp-baekjoon/4724/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/1904-01tile-c-dp-baekjoon/4724/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 17 Jan 2023 01:18:05 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[01타일]]></category>
		<category><![CDATA[1904]]></category>
		<category><![CDATA[1904번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 1904]]></category>
		<category><![CDATA[백준 1904번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4724</guid>

					<description><![CDATA[<p>백준 1904번 "01타일" 문제에 대한 글입니다. DP 알고리즘을 이용하여 해결하였습니다. (This is an article about the "01 Tile" problem in Baekjun 1904. It was solved using DP algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/1904-01tile-c-dp-baekjoon/4724/">백준 1904번 (01타일, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



<h1 class="wp-block-heading">01타일</h1>



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



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



<figure id="problem-info" class="wp-block-table has-small-font-size"><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.75 초</td><td class="has-text-align-left" data-align="left">256 MB</td><td class="has-text-align-left" data-align="left">76955</td><td class="has-text-align-left" data-align="left">25059</td><td class="has-text-align-left" data-align="left">19897</td><td class="has-text-align-left" data-align="left">31.856%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">지원이에게 2진 수열을 가르쳐 주기 위해, 지원이 아버지는 그에게 타일들을 선물해주셨다. </p>



<p class="has-medium-font-size">그리고 이 각각의 타일들은 0 또는 1이 쓰여 있는 낱장의 타일들이다.</p>



<p class="has-medium-font-size">어느 날 짓궂은 동주가 지원이의 공부를 방해하기 위해 </p>



<p class="has-medium-font-size">0이 쓰여진 낱장의 타일들을 붙여서 한 쌍으로 이루어진 00 타일들을 만들었다. </p>



<p class="has-medium-font-size">결국 현재 1 하나만으로 이루어진 타일 또는 0타일을 두 개 붙인 한 쌍의 00타일들만이 남게 되었다.</p>



<p class="has-medium-font-size">그러므로 지원이는 타일로 더 이상 크기가 N인 모든 2진 수열을 만들 수 없게 되었다. </p>



<p class="has-medium-font-size">예를 들어, N=1일 때 1만 만들 수 있고, N=2일 때는 00, 11을 만들 수 있다. (01, 10은 만들 수 없게 되었다.) </p>



<p class="has-medium-font-size">또한 N=4일 때는 0011, 0000, 1001, 1100, 1111 등 총 5개의 2진 수열을 만들 수 있다.</p>



<p class="has-medium-font-size">우리의 목표는 N이 주어졌을 때 지원이가 만들 수 있는 모든 가짓수를 세는 것이다. </p>



<p class="has-medium-font-size">단 타일들은 무한히 많은 것으로 가정하자.</p>



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



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



<p class="has-medium-font-size">첫 번째 줄에 자연수 N이 주어진다. (1 ≤ N ≤ 1,000,000)</p>



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



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



<p class="has-medium-font-size">첫 번째 줄에 지원이가 만들 수 있는 길이가 N인 모든 2진 수열의 개수를 15746으로 나눈 나머지를 출력한다.</p>



<div style="height:44px" 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="">4</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="">5</pre>



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



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



<ul class="wp-block-list">
<li>문제의 오타를 찾은 사람: <a href="https://www.acmicpc.net/user/mwy3055" target="_blank" rel="noreferrer noopener">mwy3055</a></li>



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



<div style="height:49px" 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/25" target="_blank" rel="noreferrer noopener">다이나믹 프로그래밍</a></li>
</ul>



<div style="height:45px" 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-image size-full"><img decoding="async" width="957" height="676" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_094838437-1.jpg" alt="" class="wp-image-4728" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_094838437-1.jpg 957w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_094838437-1-300x212.jpg 300w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230117_094838437-1-768x542.jpg 768w" sizes="(max-width: 957px) 100vw, 957px" /></figure>



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



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



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

using namespace std;

long long int dp[1000001];

constexpr int MOD = 15746;

int main()
{
	cin >> dp[0];

	// DP 배열 초기화
	for (int i = 1; i &lt; 3; i++) 
		dp[i] = i;

	for (int i = 3; i &lt;= dp[0]; i++) 	// 모듈러 산술
		dp[i] = (dp[i - 1] % MOD + dp[i - 2] % MOD ) % MOD;

	cout &lt;&lt; dp[dp[0]];

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1038" height="147" src="https://lycos7560.com/wp-content/uploads/image-985.png" alt="" class="wp-image-4725" srcset="https://lycos7560.com/wp-content/uploads/image-985.png 1038w, https://lycos7560.com/wp-content/uploads/image-985-300x42.png 300w, https://lycos7560.com/wp-content/uploads/image-985-768x109.png 768w" sizes="(max-width: 1038px) 100vw, 1038px" /></figure>



<div style="height:28px" 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/1904-01tile-c-dp-baekjoon/4724/">백준 1904번 (01타일, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/1904-01tile-c-dp-baekjoon/4724/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 9095번 (1, 2, 3 더하기, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-9095%eb%b2%88-1-2-3-%eb%8d%94%ed%95%98%ea%b8%b0-c-dp-baekjoon/4624/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-9095%eb%b2%88-1-2-3-%eb%8d%94%ed%95%98%ea%b8%b0-c-dp-baekjoon/4624/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Sun, 15 Jan 2023 23:35:55 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[9095]]></category>
		<category><![CDATA[9095번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기본]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 9095]]></category>
		<category><![CDATA[백준 9095번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=4624</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 9095번 '1, 2, 3 더하기'  문제에 대한 글입니다. DP 를 이용하여 해결하였습니다.</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-9095%eb%b2%88-1-2-3-%eb%8d%94%ed%95%98%ea%b8%b0-c-dp-baekjoon/4624/">백준 9095번 (1, 2, 3 더하기, C++, DP) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671" crossorigin="anonymous"></script>
<!-- HorizontalAD -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5698326622209671" data-ad-slot="6908948342" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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



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



<p class="has-medium-font-size"><a href="https://www.acmicpc.net/problem/9095">https://www.acmicpc.net/problem/9095</a></p>



<div style="height:42px" 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">512 MB</td><td class="has-text-align-left" data-align="left">92458</td><td class="has-text-align-left" data-align="left">60612</td><td class="has-text-align-left" data-align="left">41244</td><td class="has-text-align-left" data-align="left">63.919%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">정수 4를 1, 2, 3의 합으로 나타내는 방법은 총 7가지가 있다. </p>



<p class="has-medium-font-size">합을 나타낼 때는 수를 1개 이상 사용해야 한다.</p>



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



<ul class="wp-block-list">
<li>1+1+1+1</li>



<li>1+1+2</li>



<li>1+2+1</li>



<li>2+1+1</li>



<li>2+2</li>



<li>1+3</li>



<li>3+1</li>
</ul>



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



<p class="has-medium-font-size">정수 n이 주어졌을 때, n을 1, 2, 3의 합으로 나타내는 방법의 수를 구하는 프로그램을 작성하시오.</p>



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



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



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



<p class="has-medium-font-size">각 테스트 케이스는 한 줄로 이루어져 있고, 정수 n이 주어진다. n은 양수이며 11보다 작다.</p>



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



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



<p class="has-medium-font-size">각 테스트 케이스마다, n을 1, 2, 3의 합으로 나타내는 방법의 수를 출력한다.</p>



<div style="height:46px" 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="">3
4
7
10</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="">7
44
274</pre>



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



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



<p><a href="https://www.acmicpc.net/category/1" target="_blank" rel="noreferrer noopener">ICPC</a> > <a href="https://www.acmicpc.net/category/7" target="_blank" rel="noreferrer noopener">Regionals</a> > <a href="https://www.acmicpc.net/category/42" target="_blank" rel="noreferrer noopener">Asia Pacific</a> > <a href="https://www.acmicpc.net/category/211" target="_blank" rel="noreferrer noopener">Korea</a> > <a href="https://www.acmicpc.net/category/detail/884" target="_blank" rel="noreferrer noopener">Asia Regional &#8211; Taejon 2001</a> PC번</p>



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



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



<figure class="wp-block-image size-full"><img decoding="async" width="1600" height="838" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230116_083323110.jpg" alt="" class="wp-image-4627" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230116_083323110.jpg 1600w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230116_083323110-300x157.jpg 300w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230116_083323110-768x402.jpg 768w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230116_083323110-1536x804.jpg 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /></figure>



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



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



<div style="height:38px" 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;

int N, temp;
int arr[12];
list&lt;int> myList;

int main()
{
	cin >> N;
	arr[1] = 1;
	arr[2] = 2;
	arr[3] = 4;

	for (int i = 0; i &lt; N; i++) {

		cin >> temp;

		for (int j = 4; j &lt;= temp; j++) {

			if (arr[j] != 0) continue;

			arr[j] = arr[j - 1] + arr[j - 2] + arr[j - 3];
		}

		myList.push_back(arr[temp]);

	}

	for (auto it = myList.begin(); it != myList.end(); it++) cout &lt;&lt; *it &lt;&lt; "\n";

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1043" height="105" src="https://lycos7560.com/wp-content/uploads/image-947.png" alt="" class="wp-image-4625" srcset="https://lycos7560.com/wp-content/uploads/image-947.png 1043w, https://lycos7560.com/wp-content/uploads/image-947-300x30.png 300w, https://lycos7560.com/wp-content/uploads/image-947-768x77.png 768w" sizes="(max-width: 1043px) 100vw, 1043px" /></figure>



<div style="height:49px" 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-9095%eb%b2%88-1-2-3-%eb%8d%94%ed%95%98%ea%b8%b0-c-dp-baekjoon/4624/">백준 9095번 (1, 2, 3 더하기, C++, DP) [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-9095%eb%b2%88-1-2-3-%eb%8d%94%ed%95%98%ea%b8%b0-c-dp-baekjoon/4624/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 12865번 (평범한 배낭, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-12865-ordinary-backpack-c-dp-baekjoon/3886/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-12865-ordinary-backpack-c-dp-baekjoon/3886/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Thu, 05 Jan 2023 14:40:32 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[12865]]></category>
		<category><![CDATA[12865번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 12865]]></category>
		<category><![CDATA[백준 12865번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[평범한 배낭]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=3886</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 12865번 '평범한 배낭' 문제에 대한 글입니다. 'DP' 를 사용해서 문제를 해결하였습니다. (This is an article on the 'ordinary backpack' problem in BAEKJOON No. 12865. Problem solved using 'DP'.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-12865-ordinary-backpack-c-dp-baekjoon/3886/">백준 12865번 (평범한 배낭, C++, DP) [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:100px" 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/12865" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/12865</a></p>



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



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



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



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



<p class="has-medium-font-size">이 문제는 아주 평범한 배낭에 관한 문제이다.</p>



<p class="has-medium-font-size">한 달 후면 국가의 부름을 받게 되는 준서는 여행을 가려고 한다. </p>



<p class="has-medium-font-size">세상과의 단절을 슬퍼하며 최대한 즐기기 위한 여행이기 때문에, 가지고 다닐 배낭 또한 최대한 가치 있게 싸려고 한다.</p>



<p class="has-medium-font-size">준서가 여행에 필요하다고 생각하는 N개의 물건이 있다. </p>



<p class="has-medium-font-size">각 물건은 무게 W와 가치 V를 가지는데, 해당 물건을 배낭에 넣어서 가면 준서가 V만큼 즐길 수 있다. </p>



<p class="has-medium-font-size">아직 행군을 해본 적이 없는 준서는 최대 K만큼의 무게만을 넣을 수 있는&nbsp;배낭만 들고 다닐 수 있다. </p>



<p class="has-medium-font-size">준서가 최대한 즐거운 여행을 하기 위해 배낭에 넣을 수 있는 물건들의 가치의 최댓값을 알려주자.</p>



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



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



<p class="has-medium-font-size">첫 줄에 물품의 수 N(1 ≤ N ≤ 100)과 준서가 버틸 수 있는 무게 K(1 ≤ K ≤ 100,000)가 주어진다. </p>



<p class="has-medium-font-size">두 번째 줄부터 N개의 줄에 거쳐 각 물건의 무게 W(1 ≤ W ≤ 100,000)와 해당 물건의 가치 V(0 ≤ V ≤ 1,000)가 주어진다.</p>



<p class="has-medium-font-size">입력으로 주어지는 모든 수는 정수이다.</p>



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



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



<p class="has-medium-font-size">한 줄에 배낭에 넣을 수 있는 물건들의 가치합의 최댓값을 출력한다.</p>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">4 7
6 13
4 8
3 6
5 12</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="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">14</pre>



<div style="height:50px" 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/Acka" target="_blank" rel="noreferrer noopener">Acka</a></li>



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



<div style="height:55px" 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/25" target="_blank" rel="noreferrer noopener">다이나믹 프로그래밍</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/148" target="_blank" rel="noreferrer noopener">배낭 문제</a></li>
</ul>



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



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



<p class="has-medium-font-size">N개의 물건 (1 ≤ N ≤ 100) </p>



<p class="has-medium-font-size">물건은 무게 W와 가치 V를 가지고 있다. (1 ≤ W ≤ 100,000 / 0 ≤ V ≤ 1,000)</p>



<p class="has-medium-font-size">K만큼의 무게만을 넣을 수 있는&nbsp;배낭 (1 ≤ K ≤ 100,000)</p>



<p class="has-medium-font-size">원하는 답은 배낭에 넣을 수 있는 물건들의 가치의 최댓값</p>



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



<p class="has-medium-font-size">첫 줄 =&gt; 물품의 수 N 과  버틸 수 있는 무게 K</p>



<p class="has-medium-font-size">N 줄 =&gt; 물건의 무게 W / 물건의 가치 V</p>



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



<h2 class="has-large-font-size wp-block-heading">잘못된 접근법</h2>



<p class="has-medium-font-size">만약 물건이 2개라고 가정한다면  (A, B)  </p>



<p class="has-medium-font-size">A를 가방에 넣고 / 안넣고 2가지의 경우의 수 (2)</p>



<p class="has-medium-font-size">B를 가방에 넣고 / 안넣고 2가지의 경우의 수 (2)</p>



<p class="has-medium-font-size">=&gt; 총 2^2의 경우의 수가 발생한다.  (2) x (2)</p>



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



<p class="has-medium-font-size">물건의 수가 적을 경우에는 각 경우에서 가방에 넣은 물건들의 무게와 가치 등을 이용하여 </p>



<p class="has-medium-font-size">문제를 해결할 수 있지만 물건의 개수는 총 100개 까지 가능하므로</p>



<p class="has-medium-font-size">100개 2^100의 경우의 수가 나온다.</p>



<p class="has-medium-font-size">2^100은 1,267,650,600,228,229,401,496,703,205,376</p>



<p class="has-medium-font-size">1,267,650,600,228,229,401,496,703,205,376의 경우에 수를 모두 확인 한다면 당연하게 시간 초과로 고통을 받을 것이다.</p>



<p class="has-medium-font-size">그러므로 위와 같은 접근은 잘못된 접근 방법이다.</p>



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



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



<figure class="wp-block-image size-full"><img decoding="async" width="707" height="812" src="https://lycos7560.com/wp-content/uploads/image-795.png" alt="" class="wp-image-3898" srcset="https://lycos7560.com/wp-content/uploads/image-795.png 707w, https://lycos7560.com/wp-content/uploads/image-795-261x300.png 261w" sizes="(max-width: 707px) 100vw, 707px" /></figure>



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



<p class="has-medium-font-size">0011 즉 A,B가 같이 가방에 들어간다면 가방의 하중을 넘어서 답이 될 수 없다.</p>



<p class="has-medium-font-size">0011이 답이 될 수 없다면 결국 1011, 1100, 0100 도 답에서 제외가 된다.</p>



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



<figure class="wp-block-image size-full"><img decoding="async" width="673" height="785" src="https://lycos7560.com/wp-content/uploads/image-796.png" alt="" class="wp-image-3899" srcset="https://lycos7560.com/wp-content/uploads/image-796.png 673w, https://lycos7560.com/wp-content/uploads/image-796-257x300.png 257w" sizes="(max-width: 673px) 100vw, 673px" /></figure>



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



<figure class="wp-block-image size-full"><img decoding="async" width="679" height="771" src="https://lycos7560.com/wp-content/uploads/image-797.png" alt="" class="wp-image-3900" srcset="https://lycos7560.com/wp-content/uploads/image-797.png 679w, https://lycos7560.com/wp-content/uploads/image-797-264x300.png 264w" sizes="(max-width: 679px) 100vw, 679px" /></figure>



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



<figure class="wp-block-image size-full"><img decoding="async" width="895" height="806" src="https://lycos7560.com/wp-content/uploads/image-798.png" alt="" class="wp-image-3901" srcset="https://lycos7560.com/wp-content/uploads/image-798.png 895w, https://lycos7560.com/wp-content/uploads/image-798-300x270.png 300w, https://lycos7560.com/wp-content/uploads/image-798-768x692.png 768w" sizes="(max-width: 895px) 100vw, 895px" /></figure>



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



<p class="has-medium-font-size">진행하면서 많은 경우의 수를 줄일 수 있지만 코딩하기도 쉽지 않고 배열을 선언하는 것도 난감하다.</p>



<p class="has-medium-font-size">다른 방향으로 접근이 필요하다.</p>



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



<h2 class="has-large-font-size wp-block-heading">가방의 무게를 기준으로 접근</h2>



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



<figure class="wp-block-image size-large"><img decoding="async" width="926" height="3000" src="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-926x3000.jpg" alt="" class="wp-image-3953" srcset="https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-926x3000.jpg 926w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-93x300.jpg 93w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-768x2489.jpg 768w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-474x1536.jpg 474w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-632x2048.jpg 632w, https://lycos7560.com/wp-content/uploads/KakaoTalk_20230105_232146135-scaled.jpg 593w" sizes="(max-width: 926px) 100vw, 926px" /></figure>



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



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



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

// 물건의 개수 N와 가방의 무게 한도 K
int N, K;

// 아이템의 무게를 저장, 아이템의 가치를 저장
int iW[101], iV[101];

// [i][j] 
// i => 물건의 순서 / j => 가방의 무게
int arr[101][100001];

void GetInput()
{
	// 물건의 개수와 가방의 무게 한도 입력 받기
	cin >> N >> K;

	int cnt = 1;
	while (cnt &lt;= N) { // 물건의 무게와 가치를 입력받음
		cin >> iW[cnt] >> iV[cnt];
		cnt++;
	}
}

int main()
{
	GetInput();

    for (int i = 1; i &lt;= N; i++) {
        for (int j = 1; j &lt;= K; j++) {
			if (j - iW[i] >= 0) {  // 가방 한도 - 현재 물건의 무게 
				// 물건을 넣을 수 있는 경우 (위의 연산이 >= 0)
				
				arr[i][j] = max(arr[i - 1][j], arr[i - 1][j - iW[i]] + iV[i]);
				// 둘중에서 최대 값을 찾는 함수 max
			}
			else { 
				// 물건을 넣을 수 없는 경우 (위의 연산이 음수)
				arr[i][j] = arr[i - 1][j];
			}
        }
    }

	// 마지막까지 연산한다면 arr[N][K] 값이 최대 가치가 된다.
	cout &lt;&lt; arr[N][K];

	return 0;
}</pre>



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



<p class="has-medium-font-size">DP 문제는 풀어도 풀어도 적응이 안된다.</p>



<p class="has-medium-font-size">이 문제만 3시간 정도 생각해봤는데 혼자서 해결 불가능&#8230; ㅠ</p>



<p class="has-medium-font-size">영상 및 블로그를 참고하면서 직접 손으로 해보면 어느 정도 감이 잡히는 것 같다.</p>



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



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



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



<h2 class="wp-block-heading">도움된 자료</h2>



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



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="백준 12865번(평범한 배낭) 문제 풀이 [로밍맨] (Baekjoon online judge problem solving)" width="1778" height="1000" src="https://www.youtube.com/embed/uggO0uzGboY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div></figure>



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



<p class="has-medium-font-size"><a href="https://yabmoons.tistory.com/571" target="_blank" rel="noreferrer noopener">https://yabmoons.tistory.com/571</a> &lt;- 블로그</p>



<p class="has-medium-font-size"><a href="https://gamedoridori.tistory.com/20" target="_blank" rel="noreferrer noopener">https://gamedoridori.tistory.com/20</a> &lt;- 블로그</p>



<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-12865-ordinary-backpack-c-dp-baekjoon/3886/">백준 12865번 (평범한 배낭, C++, DP) [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-12865-ordinary-backpack-c-dp-baekjoon/3886/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 2775번 (부녀회장이 될테야, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2775-i-will-be-the-president-of-the-womens-association-c-dp-baekjoon/3915/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2775-i-will-be-the-president-of-the-womens-association-c-dp-baekjoon/3915/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 04 Jan 2023 18:52:50 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2775]]></category>
		<category><![CDATA[2775번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[구현]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 2775]]></category>
		<category><![CDATA[백준 2775번]]></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=3915</guid>

					<description><![CDATA[<p>백준 2775번 "부녀회장이 될테야" 문제에 대한 글입니다. DP 알고리즘을 이용하여 해결하였습니다. (This is an article on the question of "I will be the president of the women's association" in Baekjun 2775. It was solved using DP algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2775-i-will-be-the-president-of-the-womens-association-c-dp-baekjoon/3915/">백준 2775번 (부녀회장이 될테야, C++, DP) [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:100px" 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/2775" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/2775</a></p>



<div style="height:30px" 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">128 MB</td><td class="has-text-align-left" data-align="left">81014</td><td class="has-text-align-left" data-align="left">45363</td><td class="has-text-align-left" data-align="left">38768</td><td class="has-text-align-left" data-align="left">56.497%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">평소 반상회에 참석하는 것을 좋아하는 주희는 이번 기회에 부녀회장이 되고 싶어 </p>



<p class="has-medium-font-size">각 층의 사람들을 불러 모아 반상회를 주최하려고 한다.</p>



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



<p class="has-medium-font-size">이 아파트에 거주를 하려면 조건이 있는데, </p>



<p class="has-medium-font-size">“a층의 b호에 살려면 자신의 아래(a-1)층의&nbsp;1호부터 b호까지 사람들의 수의 합만큼 사람들을 데려와 살아야 한다” </p>



<p class="has-medium-font-size">는 계약 조항을 꼭 지키고 들어와야 한다.</p>



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



<p class="has-medium-font-size">아파트에 비어있는 집은 없고 모든 거주민들이 이 계약 조건을 지키고 왔다고 가정했을 때, </p>



<p class="has-medium-font-size">주어지는 양의 정수 k와 n에 대해 k층에 n호에는 몇 명이 살고 있는지&nbsp;출력하라. </p>



<p class="has-medium-font-size">단, 아파트에는 0층부터 있고 각층에는 1호부터 있으며, 0층의&nbsp;i호에는 i명이 산다.</p>



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



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



<p class="has-medium-font-size">첫 번째 줄에 Test case의 수 T가 주어진다. </p>



<p class="has-medium-font-size">그리고 각각의 케이스마다 입력으로 첫 번째 줄에 정수 k, 두 번째 줄에 정수 n이 주어진다</p>



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



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



<p class="has-medium-font-size">각각의 Test case에 대해서 해당 집에 거주민 수를 출력하라.</p>



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



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



<ul class="wp-block-list">
<li>1 ≤ k, n ≤ 14</li>
</ul>



<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="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">2
1
3
2
3</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="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">6
10</pre>



<div style="height:49px" 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/apjw6112" target="_blank" rel="noreferrer noopener">apjw6112</a>,&nbsp;<a href="https://www.acmicpc.net/user/seecimi" target="_blank" rel="noreferrer noopener">seecimi</a>,&nbsp;<a href="https://www.acmicpc.net/user/sunhong" target="_blank" rel="noreferrer noopener">sunhong</a></li>



<li>어색한 표현을 찾은 사람: <a href="https://www.acmicpc.net/user/veydpz">ve</a><a href="https://www.acmicpc.net/user/veydpz" target="_blank" rel="noreferrer noopener">ydpz</a></li>
</ul>



<div style="height:30px" 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/25" target="_blank" rel="noreferrer noopener">다이나믹 프로그래밍</a></li>
</ul>



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



<h2 class="wp-block-heading">문제를 표로 정리</h2>



<figure class="wp-block-image size-full"><img decoding="async" width="1431" height="402" src="https://lycos7560.com/wp-content/uploads/image-801.png" alt="" class="wp-image-3919" srcset="https://lycos7560.com/wp-content/uploads/image-801.png 1431w, https://lycos7560.com/wp-content/uploads/image-801-300x84.png 300w, https://lycos7560.com/wp-content/uploads/image-801-768x216.png 768w" sizes="(max-width: 1431px) 100vw, 1431px" /></figure>



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



<p class="has-medium-font-size">0층의 i호에는 i명이 산다.</p>



<p class="has-medium-font-size">“a층의 b호에 살려면 자신의 아래(a-1)층의 1호부터 b호까지 사람들의 수의 합만큼 사람들을 데려와 살아야 한다”</p>



<p class="has-medium-font-size">=> 2층의 3호에 살려면 1층의 1~3호까지 사람들의 수의 합만큼 사람들을 데려와 살아야 한다.</p>



<p class="has-medium-font-size">위의 표를 보면 1층의 1~2호까지 사람들의 수의 합은 2층의 2호와 같다.</p>



<p class="has-medium-font-size">i를 층 / j를 호라고 한다면 arr[i][j] = arr[i][j-1] + arr[i-1][j]와 같다.</p>



<p class="has-medium-font-size">0 ~ 14층까지 1호를 모두 1로 초기화, 0층의 1 ~ 14호까지 초기화를 진행하고 DP를 이용하여 해결하면 될 것 같다.  </p>



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



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



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

// arr[14][14]까지 이용  14층 14호
// arr[i][j]  i => 층 // j => 호
int arr[15][15];

// 문제의 입력을 처리하는 함수
void GetInput()
{
	int N;
	cin >> N;
	pair&lt;int, int> tempPair;

	while (N-- > 0) {
		cin >> tempPair.first >> tempPair.second;
		testCaseList.push_back(tempPair);
	}
}

// DP 배열을 초기화 해주는 함수
void DP_Initialization()
{
	// 0 ~ 14층 => 모든 층의 1호를 1로 초기화
	for (int i = 0; i &lt;= 14; i++) { arr[i][1] = 1; }
	// 0층 1 ~ 14호 => N호를 N명으로 초기화 // 1호는 위에서 함
	for (int i = 2; i &lt;= 14; i++) { arr[0][i] = i; }
}

int main()
{
	GetInput(); // 입력
	DP_Initialization(); // DP 배열 초기화

	// arr[i][j] = arr[i][j-1] + arr[i-1][j]
	for (int i = 1; i &lt;= 14; i++) { // 0 층은 초기화에서 함
		for (int j = 2; j &lt;= 14; j++) { // 1호는 초기화에서 함
			arr[i][j] = arr[i][j - 1] + arr[i - 1][j];
		}
	}

	// 테스트 케이스만큼 순회
	for (auto i = testCaseList.begin(); i != testCaseList.end(); i++) {
		// arr[층][호] = 몇 명이 살고 있는가? 
		cout &lt;&lt; arr[i->first][i->second] &lt;&lt; "\n";
	}
	
	return 0;
}
</pre>



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



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



<p> </p>



<div style="height:30px" 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-2775-i-will-be-the-president-of-the-womens-association-c-dp-baekjoon/3915/">백준 2775번 (부녀회장이 될테야, C++, DP) [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-2775-i-will-be-the-president-of-the-womens-association-c-dp-baekjoon/3915/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 17202번 (핸드폰 번호 궁합, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-17202%eb%b2%88-%ed%95%b8%eb%93%9c%ed%8f%b0-%eb%b2%88%ed%98%b8-%ea%b6%81%ed%95%a9-c-dp-baekjoon/3904/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-17202%eb%b2%88-%ed%95%b8%eb%93%9c%ed%8f%b0-%eb%b2%88%ed%98%b8-%ea%b6%81%ed%95%a9-c-dp-baekjoon/3904/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Wed, 04 Jan 2023 17:32:40 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[17202]]></category>
		<category><![CDATA[17202번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 17202]]></category>
		<category><![CDATA[백준 17202번]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<category><![CDATA[핸드폰 번호 궁합]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=3904</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 17202번 문제에 대한 글입니다. (This is an article on question 17202 of BAEKJOON.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-17202%eb%b2%88-%ed%95%b8%eb%93%9c%ed%8f%b0-%eb%b2%88%ed%98%b8-%ea%b6%81%ed%95%a9-c-dp-baekjoon/3904/">백준 17202번 (핸드폰 번호 궁합, C++, DP) [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:100px" 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/17202" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/17202</a></p>



<div style="height:30px" 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">2 초</td><td class="has-text-align-left" data-align="left">256 MB</td><td class="has-text-align-left" data-align="left">1900</td><td class="has-text-align-left" data-align="left">1432</td><td class="has-text-align-left" data-align="left">1275</td><td class="has-text-align-left" data-align="left">77.413%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">어린시절 다들 한 번씩은 이름으로 궁합을 본 적이 있을 것이다. </p>



<p class="has-medium-font-size">이것과 비슷한 방식으로 중앙대학교에는 핸드폰 번호 궁합을 보는 것이 유행이라고 한다.</p>



<p class="has-medium-font-size">핸드폰 번호 궁합을 보기 위해서는 먼저 궁합을 보고싶은 두 중앙대생 A와 B의 핸드폰 번호에서 </p>



<p class="has-medium-font-size">맨 앞의 010과 &#8220;-&#8220;(하이픈)을 모두 제외한 후<strong>, </strong>A부터 시작하여 한 숫자씩 번갈아가면서 적는다. </p>



<p class="has-medium-font-size">그리고 인접한 두 숫자끼리 더한 값의 일의 자리를 두 숫자의 아래에 적어나가면서 마지막에 남는 숫자 2개로 궁합률을 구하게 된다.</p>



<p class="has-medium-font-size">예를 들어, 아래의 그림과 같이 A의 번호가 010-7475-9336 이고, B의 번호가 010-3619-5974 이면, </p>



<p class="has-medium-font-size">7346715995393764에서 시작하여 070386484822030, 77314022204233, 4045424424656, </p>



<p class="has-medium-font-size">449966866011, 83852442612, 1137686873, 240344450, 64378895, 0705674, 775131, </p>



<p class="has-medium-font-size">42644, 6808, 488, 26이 되어 둘은 26%의 궁합률을 가지게 된다.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="635" height="581" src="https://lycos7560.com/wp-content/uploads/image-799.png" alt="" class="wp-image-3906" srcset="https://lycos7560.com/wp-content/uploads/image-799.png 635w, https://lycos7560.com/wp-content/uploads/image-799-300x274.png 300w" sizes="(max-width: 635px) 100vw, 635px" /></figure>



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



<p class="has-medium-font-size">위의 예시에서처럼 인접한 두 숫자를 더한 값이 두자리 정수가 되더라도, 일의 자리 숫자만 적는다. </p>



<p class="has-medium-font-size">가령 7과 3을 더하면 0을 적고, 4와 8을 더하면 2를 적는다.</p>



<p class="has-medium-font-size">중앙대학교에서 유행인 핸드폰 번호 궁합률을 알아보는 프로그램을 작성해보자. </p>



<p class="has-medium-font-size">단, A와 B의 핸드폰 번호는 다르다고 가정한다.</p>



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



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



<p class="has-medium-font-size">첫 번째 줄에는 궁합을 보고싶은 중앙대생 A의 핸드폰 번호가 주어진다.</p>



<p class="has-medium-font-size">두 번째 줄에는 궁합을 보고싶은 상대방 B의 핸드폰 번호가 주어진다.</p>



<p class="has-medium-font-size">핸드폰 번호는 맨 앞의 010과 &#8220;-&#8220;(하이픈)을 제외하여&nbsp;숫자 8개로&nbsp;주어진다.</p>



<p class="has-medium-font-size">A와 B의 핸드폰 번호는 같지 않다.</p>



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



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



<p class="has-medium-font-size">A와 B의 핸드폰 번호 궁합률을&nbsp;두자리 정수로 출력한다.</p>



<p class="has-medium-font-size">십의 자리가 0이어도 앞에 0을 붙여 두자리로 출력한다.</p>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">74759336
36195974</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="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">26</pre>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">01234567
12345678</pre>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">02</pre>



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



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



<p><a href="https://www.acmicpc.net/category/5" target="_blank" rel="noreferrer noopener">University</a> > <a href="https://www.acmicpc.net/category/400" target="_blank" rel="noreferrer noopener">중앙대학교</a> > <a href="https://www.acmicpc.net/category/detail/2030" target="_blank" rel="noreferrer noopener">2019 NPC (Newbie Programming Contest)</a> B번</p>



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



<div style="height:50px" 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/25" 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:30px" 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-image size-full"><img decoding="async" width="635" height="581" src="https://lycos7560.com/wp-content/uploads/image-799.png" alt="" class="wp-image-3906" srcset="https://lycos7560.com/wp-content/uploads/image-799.png 635w, https://lycos7560.com/wp-content/uploads/image-799-300x274.png 300w" sizes="(max-width: 635px) 100vw, 635px" /></figure>



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



<p class="has-medium-font-size">문제에서 주어진 그림의 첫번째 줄 => 7346715995393764</p>



<p class="has-medium-font-size">arr[0] = 7, arr[1] = 3, arr[2] = 4, arr[3] = 6, arr[4] = 7 &#8230;  이런 식으로 표현이 가능하다.</p>



<p class="has-medium-font-size">두번째 줄의 0번 인덱스는 arr[0] + arr[1] 의 나머지 값이고</p>



<p class="has-medium-font-size">이후 연산에서 arr[0]은 사용되지 않으니 새로운 배열을 만들 필요가 없다.</p>



<p class="has-medium-font-size">arr[i] = (arr[i] + arr[i+1]) % 10 으로 표현이 가능</p>



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



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



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

using namespace std;

int arr[16];

// 입력을 받는 함수
void GetInput()
{
	string tempA, tempB;
	cin >> tempA >> tempB;

	int temp = 0;
	for (int i = 0; i &lt; 8; i++){ // arr 배열에 셋팅
		arr[temp++] = tempA[i] - '0'; // char => int
		arr[temp++] = tempB[i] - '0'; // char => int
	}
}

int main()
{
	GetInput();
	
	for (int i = 15; i > 1; i--) {
		for (int j = 0; j &lt; i; j++) {
			arr[j] = (arr[j] + arr[j + 1]) % 10;
		}
	}

	cout &lt;&lt; arr[0] &lt;&lt; arr[1];

	return 0;
}</pre>



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



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



<div style="height:50px" 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>



<div style="height:41px" aria-hidden="true" class="wp-block-spacer"></div>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-17202%eb%b2%88-%ed%95%b8%eb%93%9c%ed%8f%b0-%eb%b2%88%ed%98%b8-%ea%b6%81%ed%95%a9-c-dp-baekjoon/3904/">백준 17202번 (핸드폰 번호 궁합, C++, DP) [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-17202%eb%b2%88-%ed%95%b8%eb%93%9c%ed%8f%b0-%eb%b2%88%ed%98%b8-%ea%b6%81%ed%95%a9-c-dp-baekjoon/3904/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>백준 10844번 (쉬운 계단 수, C++, DP) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10844-the-easy-number-of-stairsc-dp-baekjoon/3864/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10844-the-easy-number-of-stairsc-dp-baekjoon/3864/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 03 Jan 2023 15:06:36 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[10844]]></category>
		<category><![CDATA[10844번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[DP]]></category>
		<category><![CDATA[DynamicProgramming]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[다이나믹 프로그래밍]]></category>
		<category><![CDATA[모듈러 산술]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 10844]]></category>
		<category><![CDATA[백준 10844번]]></category>
		<category><![CDATA[쉬운 계단 수]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[점화식]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=3864</guid>

					<description><![CDATA[<p>백준(BAEKJOON) 10844번 쉬운 계단 수 문제에 대한 글입니다. DP를 사용하였습니다. (This is an article about the easy number of stairs in BAEKJOON 10844. DP has been used.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-10844-the-easy-number-of-stairsc-dp-baekjoon/3864/">백준 10844번 (쉬운 계단 수, C++, DP) [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:100px" 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/10844" target="_blank" rel="noreferrer noopener">https://www.acmicpc.net/problem/10844</a></p>



<div style="height:50px" 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">116877</td><td class="has-text-align-left" data-align="left">36976</td><td class="has-text-align-left" data-align="left">26702</td><td class="has-text-align-left" data-align="left">29.843%</td></tr></tbody></table></figure>



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



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



<p class="has-medium-font-size">45656이란 수를 보자.</p>



<p class="has-medium-font-size">이 수는 인접한 모든 자리의 차이가 1이다. </p>



<p class="has-medium-font-size">이런 수를 계단 수라고 한다.</p>



<p class="has-medium-font-size">N이 주어질 때, 길이가 N인 계단 수가 총 몇 개 있는지 구해보자. </p>



<p class="has-medium-font-size">0으로 시작하는 수는 계단수가 아니다.</p>



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



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



<p class="has-medium-font-size">첫째 줄에 N이 주어진다. N은 1보다 크거나 같고, 100보다 작거나 같은 자연수이다.</p>



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



<p class="has-medium-font-size">첫째 줄에 정답을 1,000,000,000으로 나눈 나머지를 출력한다.</p>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">1</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="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">9</pre>



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



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



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



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">17</pre>



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



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



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



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">18404112</pre>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">70</pre>



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



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



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">564706557</pre>



<div style="height:100px" 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:52px" 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/25" target="_blank" rel="noreferrer noopener">다이나믹 프로그래밍</a></li>
</ul>



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



<h2 class="wp-block-heading">접근하는 방법</h2>



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



<p class="has-medium-font-size">N = 1 =&gt; 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 (0으로 시작하는 수는 계단수가 아니다.)</p>



<p class="has-medium-font-size">N = 2 =&gt; 10 / 12 / 21 / 23 / 32 / 34 / 43 / 45 / 54 / 56 / 65 / 67 / 76 / 78 / 87 / 89 /&nbsp;98</p>



<p class="has-medium-font-size">N = 3 =&gt; 101&nbsp;/ 121 / 123 / 210 / 212 / 321 / 324 &#8230;.</p>



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



<p class="has-large-font-size"><strong>N = 2 일 경우를 예시로 들어보면 </strong></p>



<p class="has-medium-font-size">마지막 숫자 전 수가 2인 경우  마지막 숫자에 올 수 있는 수는 1, 3 &#8211; 2가지의 경우  / 21, 23 </p>



<p class="has-medium-font-size">마지막 숫자 전 수가 3인 경우  마지막 숫자에 올 수 있는 수는 2, 4 &#8211; 2가지의 경우  / 32, 34 </p>



<p class="has-medium-font-size">마지막 숫자가 0 이라면 1가지의 경우 / 10</p>



<p class="has-medium-font-size">마지막 숫자가 9 라면 1가지의 경우 / 89</p>



<p class="has-medium-font-size">위의 내용을 표로 정리하면 아래와 같이 나온다.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1158" height="535" src="https://lycos7560.com/wp-content/uploads/image-791.png" alt="" class="wp-image-3868" srcset="https://lycos7560.com/wp-content/uploads/image-791.png 1158w, https://lycos7560.com/wp-content/uploads/image-791-300x139.png 300w, https://lycos7560.com/wp-content/uploads/image-791-768x355.png 768w" sizes="(max-width: 1158px) 100vw, 1158px" /></figure>



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



<p class="has-medium-font-size">&nbsp;N의 범위는 1&lt;= N &lt;= 100 </p>



<p class="has-medium-font-size">구하는 값은 계단 수의 개수를 1,000,000,000으로 나눈 나머지를 출력하는 것</p>



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



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



<div style="height:30px" 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>

using namespace std;

constexpr int MOD = 1000000000;

int N;

// dp[i][j] 
// i = 숫자, j = 자릿수
long long dp[10][101];

// DP 초기화
void DP_Initialization()
{
	dp[0][1] = 0;
	for (int i = 1; i &lt; 10; i++) {
		dp[i][1] = 1;
	}
}

int main()
{
	cin >> N;

	long long result = 0;

	DP_Initialization();

	for (int j = 2; j &lt;= N; j++) {
		for (int i = 0; i &lt; 10; i++) {
			if (i == 0) { // 마지막 숫자가 0
				dp[i][j] = dp[1][j-1]; 
			}
			else if (i == 9) { // 마지막 숫자가 9
				dp[i][j] = dp[8][j-1];
			}
			else {
				// 모듈러 연산 덧셈
				dp[i][j] = ( (dp[i-1][j-1] % MOD) + ( dp[i + 1][j - 1] % MOD) ) % MOD;
			}
		}
	}

	for (int i = 0; i &lt; 10; i++) {
		result += ( dp[i][N] % MOD ); // 모듈러 연산 덧셈
	}

	cout &lt;&lt; result % MOD; // 모듈러 연산 덧셈

	return 0;
}</pre>



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



<figure class="wp-block-image size-full"><img decoding="async" width="1037" height="99" src="https://lycos7560.com/wp-content/uploads/image-792.png" alt="" class="wp-image-3874" srcset="https://lycos7560.com/wp-content/uploads/image-792.png 1037w, https://lycos7560.com/wp-content/uploads/image-792-300x29.png 300w, https://lycos7560.com/wp-content/uploads/image-792-768x73.png 768w" sizes="(max-width: 1037px) 100vw, 1037px" /></figure>



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



<p class="has-medium-font-size">DP 문제는 점화식을 만들기가 너무 어려운 것 같다.</p>



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



<p class="has-medium-font-size">문제가 이해하기 어렵다면 아래의 영상을 시청하는 것을 추천</p>



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



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="백준 10844번(쉬운 계단 수) 문제 풀이 [로밍맨] (Baekjoon online judge problem solving)" width="1778" height="1000" src="https://www.youtube.com/embed/Rn9G6VrBKb4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></figure>



<div style="height:60px" 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-10844-the-easy-number-of-stairsc-dp-baekjoon/3864/">백준 10844번 (쉬운 계단 수, C++, DP) [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-10844-the-easy-number-of-stairsc-dp-baekjoon/3864/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
