176 lines
11 KiB
HTML
176 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>BOJ 32189 - Offline</title>
|
|
<style>
|
|
:root {
|
|
--bg: #fafaf8;
|
|
--paper: #ffffff;
|
|
--ink: #1e1f24;
|
|
--muted: #6a6d75;
|
|
--line: #d8dce3;
|
|
--accent: #0d6e6e;
|
|
--code-bg: #f4f6fb;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
body {
|
|
margin: 0;
|
|
background:
|
|
radial-gradient(circle at 15% 0%, #f0efe9 0%, transparent 42%),
|
|
radial-gradient(circle at 85% 20%, #e7f1f2 0%, transparent 38%),
|
|
var(--bg);
|
|
color: var(--ink);
|
|
font-family: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", sans-serif;
|
|
line-height: 1.65;
|
|
}
|
|
main {
|
|
max-width: 980px;
|
|
margin: 0 auto;
|
|
padding: 24px 16px 56px;
|
|
}
|
|
.header {
|
|
background: var(--paper);
|
|
border: 1px solid var(--line);
|
|
border-radius: 14px;
|
|
padding: 18px 20px;
|
|
margin-bottom: 18px;
|
|
}
|
|
.header h1 { margin: 0 0 6px; font-size: 1.5rem; }
|
|
.header p { margin: 0; color: var(--muted); font-size: 0.95rem; }
|
|
.header a { color: var(--accent); text-decoration: none; }
|
|
.section {
|
|
background: var(--paper);
|
|
border: 1px solid var(--line);
|
|
border-radius: 14px;
|
|
padding: 16px 18px;
|
|
margin-bottom: 14px;
|
|
overflow-x: auto;
|
|
}
|
|
h2 {
|
|
margin: 0 0 10px;
|
|
font-size: 1.05rem;
|
|
color: var(--accent);
|
|
border-bottom: 1px solid var(--line);
|
|
padding-bottom: 8px;
|
|
}
|
|
pre, code {
|
|
font-family: "JetBrains Mono", "Fira Code", monospace;
|
|
background: var(--code-bg);
|
|
}
|
|
pre {
|
|
padding: 12px;
|
|
border-radius: 10px;
|
|
border: 1px solid #e7ebf2;
|
|
overflow: auto;
|
|
}
|
|
blockquote {
|
|
margin: 14px 0;
|
|
padding: 16px 16px 14px 22px;
|
|
border-left: 4px solid var(--accent);
|
|
border-radius: 10px;
|
|
background: linear-gradient(90deg, #eef8f8 0%, #f9fdfd 100%);
|
|
color: #24313a;
|
|
font-weight: 600;
|
|
position: relative;
|
|
}
|
|
blockquote::before {
|
|
content: "“";
|
|
position: absolute;
|
|
left: 8px;
|
|
top: 2px;
|
|
font-size: 1.35rem;
|
|
line-height: 1;
|
|
color: #0b5f5f;
|
|
opacity: 0.7;
|
|
}
|
|
blockquote > :first-child { margin-top: 0; }
|
|
blockquote > :last-child { margin-bottom: 0; }
|
|
q {
|
|
color: #114f50;
|
|
font-weight: 700;
|
|
background: #edf8f8;
|
|
border-radius: 6px;
|
|
padding: 0 4px;
|
|
}
|
|
.math-inline math {
|
|
font-size: 1em;
|
|
vertical-align: middle;
|
|
}
|
|
.math-block {
|
|
margin: 10px 0;
|
|
padding: 8px 10px;
|
|
overflow-x: auto;
|
|
background: #f8fbff;
|
|
border: 1px solid #e2ecf8;
|
|
border-radius: 8px;
|
|
}
|
|
.math-block math {
|
|
font-size: 1.04em;
|
|
display: block;
|
|
}
|
|
table { border-collapse: collapse; width: 100%; }
|
|
th, td { border: 1px solid var(--line); padding: 6px 8px; }
|
|
img { max-width: 100%; height: auto; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<header class="header">
|
|
<h1>'한국디지털미디어고등학교'는 너무 길다.</h1>
|
|
</header>
|
|
<article class="section">
|
|
<h2>문제</h2>
|
|
<p>디미고의 공식 명칭인 '한국디지털미디어고등학교'는 너무 길다. 그래서 한국디지털미디어고등학교를 문과 계열의 디지털콘텐츠과와 이비지니스과 학교, 이과 계열의 웹프로그래밍과와 해킹방어과 학교 즉, 문과 학교와 이과 학교 둘로 나누어 학교 이름을 줄이려 한다. 학생회는 나눈 두 학교의 이름을 새로 지어야 한다.</p>
|
|
|
|
<p>학생회는 한국디지털미디어고등학교의 정체성을 지키기 위해 두 학교의 이름을 원래 학교 이름의 연속된 앞부분과 나머지 뒷부분으로 나누어 정하기로 했다. 예를 들어 "<code style="color:#e74c3c;">KoreaDigitalMediaHighSchool</code>"을 앞부분 "<code style="color:#e74c3c;">KoreaDigital</code>"과 뒷부분 "<code style="color:#e74c3c;">MediaHighSchool</code>"으로 나눌 수 있다. 또한 앞부분 또는 뒷부분이 빈 문자열이어도 된다.</p>
|
|
|
|
<p>이때 문과 계열과 이과 계열은 서로 라이벌 의식을 가지고 있기 때문에 나누어진 두 학교의 이름이 최대한 달랐으면 했다. 학생회는 이를 객관적으로 판단하기 위해 불일치도라는 값을 사용하기로 했다. 불일치도는 학교 이름을 나눈 두 문자열을 각각 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span>, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span>라고 했을 때 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mrow><mi mathvariant="normal">m</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi></mrow><mo stretchy="false">(</mo><mo stretchy="false">|</mo><mi>A</mi><mo stretchy="false">|</mo><mo>,</mo><mo stretchy="false">|</mo><mi>B</mi><mo stretchy="false">|</mo><mo stretchy="false">)</mo><mo>−</mo><mrow><mi mathvariant="normal">L</mi><mi mathvariant="normal">C</mi><mi mathvariant="normal">S</mi></mrow><mo stretchy="false">(</mo><mi>A</mi><mo>,</mo><mi>B</mi><mo stretchy="false">)</mo></mrow></math></span>이다. 문자열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>S</mi></mrow></math></span>에 대해 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">|</mo><mi>S</mi><mo stretchy="false">|</mo></mrow></math></span>는 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>S</mi></mrow></math></span>의 길이를 의미하며, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mrow><mi mathvariant="normal">m</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi></mrow><mo stretchy="false">(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo stretchy="false">)</mo></mrow></math></span>는 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>와 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>y</mi></mrow></math></span> 중 크지 않은 수를 의미한다.</p>
|
|
|
|
<p><span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mrow><mi mathvariant="normal">L</mi><mi mathvariant="normal">C</mi><mi mathvariant="normal">S</mi></mrow><mo stretchy="false">(</mo><mi>A</mi><mo>,</mo><mi>B</mi><mo stretchy="false">)</mo></mrow></math></span>는 대소문자를 구분하여 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span>, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span> 모두의 부분 문자열이 되는 문자열 중 가장 긴 문자열의 길이이다. 예를 들면, "<code style="color:#e74c3c;">ABCD</code>"와 "<code style="color:#e74c3c;">ABDF</code>"의 공통 부분 문자열 중 가장 긴 문자열은 "<code style="color:#e74c3c;">ABD</code>"로 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mrow><mi mathvariant="normal">L</mi><mi mathvariant="normal">C</mi><mi mathvariant="normal">S</mi></mrow><mo stretchy="false">(</mo></mrow></math></span>"<code style="color:#e74c3c;">ABCD</code>"<span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo>,</mo></mrow></math></span> "<code style="color:#e74c3c;">ABDF</code>"<span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">)</mo></mrow></math></span>는 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>3</mn></mrow></math></span>이다. 부분 문자열은 원래 문자열에서 순서를 유지하면서 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>0</mn></mrow></math></span>개 이상의 문자를 제거해 만든 문자열이다. 예를 들어, "<code><span style="color:#e74c3c;">ABC</span></code>", "<code><span style="color:#e74c3c;">BD</span></code>"는 "<code><span style="color:#e74c3c;">ABCD</span></code>"의 부분 문자열이지만 "<code><span style="color:#e74c3c;">BDC</span></code>", "<code><span style="color:#e74c3c;">EAB</span></code>", "<code><span style="color:#e74c3c;">abc</span></code>"는 아니다.</p>
|
|
|
|
<p>한국디지털미디어고등학교를 잘 나눌 수 있도록 가능한 불일치도의 최댓값을 구하자.</p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>입력</h2>
|
|
<p>첫 번째 줄에 학교 이름을 나타내는 문자열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>S</mi></mrow></math></span>가 주어진다. <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>S</mi></mrow></math></span>는 알파벳 소문자와 대문자로만 이루어져 있다. <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mo stretchy="false">(</mo><mn>1</mn><mo>≤</mo><mo stretchy="false">|</mo><mi>S</mi><mo stretchy="false">|</mo><mo>≤</mo><mn>3</mn><mspace width="0.167em" /><mn>000</mn><mo stretchy="false">)</mo></mrow></math></span></p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>출력</h2>
|
|
<p>첫 번째 줄에 불일치도의 최댓값을 출력한다.</p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 입력 1 복사</h2>
|
|
<pre class="sampledata" id="sample-input-1">KoreaDigitalMediaHighSchool
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 입력 2 복사</h2>
|
|
<pre class="sampledata" id="sample-input-2">seungchan
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 입력 3 복사</h2>
|
|
<pre class="sampledata" id="sample-input-3">ababa
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 출력 1 복사</h2>
|
|
<pre class="sampledata" id="sample-output-1">9
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 출력 2 복사</h2>
|
|
<pre class="sampledata" id="sample-output-2">3
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 출력 3 복사</h2>
|
|
<pre class="sampledata" id="sample-output-3">0
|
|
</pre>
|
|
</article>
|
|
</main>
|
|
</body>
|
|
</html>
|