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

<channel>
	<title>기타 레슨 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/%EA%B8%B0%ED%83%80-%EB%A0%88%EC%8A%A8/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Fri, 15 Mar 2024 15:46:10 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>기타 레슨 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>백준 2343번 (기타 레슨, C++) [BAEKJOON]</title>
		<link>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2343%eb%b2%88-%ea%b8%b0%ed%83%80-%eb%a0%88%ec%8a%a8-c-baekjoon/36681/</link>
					<comments>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2343%eb%b2%88-%ea%b8%b0%ed%83%80-%eb%a0%88%ec%8a%a8-c-baekjoon/36681/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Tue, 12 Sep 2023 05:58:06 +0000</pubDate>
				<category><![CDATA[BaekjoonOnlineJudge]]></category>
		<category><![CDATA[C++/CPP]]></category>
		<category><![CDATA[2343]]></category>
		<category><![CDATA[2343번]]></category>
		<category><![CDATA[Baekjoon]]></category>
		<category><![CDATA[Binary Search]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[Sliver]]></category>
		<category><![CDATA[Sliver1]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[공부]]></category>
		<category><![CDATA[기초]]></category>
		<category><![CDATA[기타 레슨]]></category>
		<category><![CDATA[백준]]></category>
		<category><![CDATA[백준 2343]]></category>
		<category><![CDATA[백준 2343번]]></category>
		<category><![CDATA[실버]]></category>
		<category><![CDATA[실버1]]></category>
		<category><![CDATA[알고리즘]]></category>
		<category><![CDATA[이분 탐색]]></category>
		<category><![CDATA[이분탐색]]></category>
		<category><![CDATA[코딩테스트]]></category>
		<category><![CDATA[코테]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=36681</guid>

					<description><![CDATA[<p>백준 2343번 '기타 레슨' 문제에 대한 글입니다. '이분 탐색' 알고리즘을 이용하여 해결하였습니다. (This is an article about Baekjoon Number 2343 'Guitar Lesson' problem. It was solved using the 'Binary Search' algorithm.)</p>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2343%eb%b2%88-%ea%b8%b0%ed%83%80-%eb%a0%88%ec%8a%a8-c-baekjoon/36681/">백준 2343번 (기타 레슨, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="5078714126"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



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


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-75779d84      "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							목차 테이블						</div>
																						<div class="uagb-toc__list-wrap ">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#기타-레슨" class="uagb-toc-link__trigger">기타 레슨</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#추가-반례" class="uagb-toc-link__trigger">추가 반례</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#통과된-코드" class="uagb-toc-link__trigger">통과된 코드</a></ul></ol>					</div>
									</div>
				</div>
			


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



<h1 class="wp-block-heading">기타 레슨 <img decoding="async" width="30" height="38" class="wp-image-37919" style="width: 30px;" src="https://lycos7560.com/wp-content/uploads/2024/03/Sliver_1.jpg" alt="" srcset="https://lycos7560.com/wp-content/uploads/2024/03/Sliver_1.jpg 1250w, https://lycos7560.com/wp-content/uploads/2024/03/Sliver_1-234x300.jpg 234w, https://lycos7560.com/wp-content/uploads/2024/03/Sliver_1-768x983.jpg 768w, https://lycos7560.com/wp-content/uploads/2024/03/Sliver_1-1200x1536.jpg 1200w" sizes="(max-width: 30px) 100vw, 30px" /></h1>



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



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



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



<p class="wp-block-paragraph">강토는 자신의 기타 강의 동영상을 블루레이로 만들어 판매하려고 한다. </p>



<p class="wp-block-paragraph">블루레이에는 총 N개의 강의가 들어가는데, 블루레이를 녹화할 때, 강의의 순서가 바뀌면 안 된다. </p>



<p class="wp-block-paragraph">순서가 뒤바뀌는 경우에는 강의의 흐름이 끊겨, 학생들이 대혼란에 빠질 수 있기 때문이다. </p>



<p class="wp-block-paragraph">즉, i번 강의와 j번 강의를 같은 블루레이에 녹화하려면 i와 j 사이의 모든 강의도 같은 블루레이에 녹화해야 한다.</p>



<p class="wp-block-paragraph">강토는 이 블루레이가 얼마나 팔릴지 아직 알 수 없기 때문에, 블루레이의 개수를 가급적 줄이려고 한다. </p>



<p class="wp-block-paragraph">오랜 고민 끝에 강토는 M개의 블루레이에 모든 기타 강의 동영상을 녹화하기로 했다. </p>



<p class="wp-block-paragraph">이때, 블루레이의 크기(녹화 가능한 길이)를 최소로 하려고 한다. </p>



<p class="wp-block-paragraph">단, M개의 블루레이는 모두 같은 크기이어야 한다.</p>



<p class="wp-block-paragraph">강토의 각 강의의 길이가 분 단위(자연수)로 주어진다. </p>



<p class="wp-block-paragraph">이때, 가능한 블루레이의 크기 중 최소를 구하는 프로그램을 작성하시오.</p>



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



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



<p class="wp-block-paragraph">첫째 줄에 강의의 수 N (1 ≤ N ≤ 100,000)과 M (1 ≤ M ≤ N)이 주어진다. </p>



<p class="wp-block-paragraph">다음 줄에는 강토의 기타 강의의 길이가 강의 순서대로 분 단위로(자연수)로 주어진다. </p>



<p class="wp-block-paragraph">각 강의의 길이는 10,000분을 넘지 않는다.</p>



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



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



<p class="wp-block-paragraph">첫째 줄에 가능한 블루레이 크기중 최소를 출력한다.</p>



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



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



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



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



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



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



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



<h3 class="wp-block-heading has-large-font-size">힌트</h3>



<p class="wp-block-paragraph">강의는 총 9개이고, 블루레이는 총 3개 가지고 있다.</p>



<p class="wp-block-paragraph">1번 블루레이에 1, 2, 3, 4, 5, 2번 블루레이에 6, 7, 3번 블루레이에 8, 9 를 넣으면 각 블루레이의 크기는 15, 13, 17이 된다. </p>



<p class="wp-block-paragraph">블루레이의 크기는 모두 같아야 하기 때문에, 블루레이의 크기는 17이 된다. </p>



<p class="wp-block-paragraph">17보다 더 작은 크기를 가지는 블루레이를 만들 수 없다.</p>



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



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



<h2 class="wp-block-heading has-large-font-size">추가 반례</h2>



<p class="wp-block-paragraph"><a href="https://www.acmicpc.net/board/search/all/problem/2343">https://www.acmicpc.net/board/search/all/problem/2343</a></p>



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



<ul class="wp-block-list">
<li>데이터를 추가한 사람:&nbsp;<a href="https://www.acmicpc.net/user/muzigae">muzigae</a>,&nbsp;<a href="https://www.acmicpc.net/user/sksdong1">sksdong1</a></li>



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



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



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



<ul class="wp-block-list">
<li><a href="https://www.acmicpc.net/problem/tag/12">이분 탐색</a></li>



<li><a href="https://www.acmicpc.net/problem/tag/170">매개 변수 탐색</a></li>
</ul>



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



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



<p class="wp-block-paragraph">이분 탐색을 이용하여 Mid 값을 구하였습니다.</p>



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



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

using namespace std;

int _N, _M, _Table[100000], _Cnt = 0;
long long _Min = 0, _Mid = 0, _Max = 0;

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

	cin >> _N >> _M;

	for (int i = 0; i &lt; _N; i++) {
		cin >> _Table[i];
		_Max += _Table[i];
		// 이분 탐색의 최솟값은 강의의 길이보다 작을 수 없다.
		_Min = max((int)_Min, _Table[i]);
	}

	// 종료조건
	while (_Min &lt;= _Max) {
		// 이분탐색
		_Mid = (_Min + _Max) / 2;
		_Cnt = 0;
		long long _Lenth = 0; // 길이의 합
		for (int i = 0; i &lt; _N; i++) {
			_Lenth += _Table[i];
			if (_Lenth > _Mid) {
				_Lenth = 0;
				_Cnt++;
				_Lenth += _Table[i];
			}
		}
		if (_Lenth > 0)
			_Cnt++;

		if (_Cnt > _M) _Min = _Mid + 1;
		else _Max = _Mid - 1;
	}

	cout &lt;&lt; _Min;

	return 0;
}
</pre>



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



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="966" height="153" src="https://lycos7560.com/wp-content/uploads/2023/09/image.png" alt="" class="wp-image-36689" srcset="https://lycos7560.com/wp-content/uploads/2023/09/image.png 966w, https://lycos7560.com/wp-content/uploads/2023/09/image-300x48.png 300w, https://lycos7560.com/wp-content/uploads/2023/09/image-768x122.png 768w" sizes="(max-width: 966px) 100vw, 966px" /></figure>



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



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5698326622209671"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-5698326622209671"
     data-ad-slot="4386247858"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>The post <a href="https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2343%eb%b2%88-%ea%b8%b0%ed%83%80-%eb%a0%88%ec%8a%a8-c-baekjoon/36681/">백준 2343번 (기타 레슨, C++) [BAEKJOON]</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/cpp/baekjoon_online_judge/%eb%b0%b1%ec%a4%80-2343%eb%b2%88-%ea%b8%b0%ed%83%80-%eb%a0%88%ec%8a%a8-c-baekjoon/36681/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
