Files
CodeObject/storage/zeta/_static/16434.html
2026-04-27 09:44:16 +09:00

188 lines
8.3 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 16434 - 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>용사에게는 세 종류의 능력치가 있습니다.&nbsp;</p>
<ul>
<li><em>H<sub>MaxHP</sub></em> : 용사의 최대 생명력입니다. 이 값은 1이상이어야 하며 던전에 들어간 이후로 변하지 않습니다.</li>
<li><em>H<sub>CurHP</sub></em> : 현재 용사의 생명력입니다. 던전에&nbsp;들어가기 전 이 값은 용사의 최대 생명력&nbsp;<em>H<sub>MaxHP</sub></em>&nbsp;같습니다. 이 값은 <em>H<sub>MaxHP</sub></em>보다 커질 수&nbsp;없습니다.</li>
<li><em>H<sub>ATK</sub></em> : 용사의 공격력입니다.</li>
</ul>
<p>던전은 총 <em>N</em>개의 방으로 이루어져 있고 <em>i</em>번째 방을 통해서만 <em>i</em>+1번째 방으로 이동 할 수 있습니다. 방에는 포션이 있거나 몬스터가 있는데 몬스터가 있을 경우 몬스터를 쓰러트려야지 다음방으로 이동 할 수 있습니다. <em>N</em>번째 방에는 공주와 용이 있고, 용을 무찌르면&nbsp;공주를 구할 수 있습니다.</p>
<p>몬스터가 있는 방에 올 경우 다음과 같이 전투가 진행됩니다.</p>
<ol>
<li>용사의 공격력&nbsp;<em>H<sub>ATK</sub></em>만큼 몬스터의 생명력을 깎습니다.</li>
<li>몬스터의 생명력이 0 이하이면 전투가 종료되고 용사는 다음 방으로 이동합니다.</li>
<li>몬스터의 공격력만큼 용사의 생명력&nbsp;<em>H<sub>CurHP</sub></em>&nbsp;깎습니다.</li>
<li>용사의 생명력이 0 이하이면 전투가 종료되고 용사는 사망합니다.</li>
<li>다시 1부터&nbsp;진행합니다.</li>
</ol>
<p>포션이 있는 방에 올 경우 포션을 마셔서&nbsp;현재 용사의 생명력 <em>H<sub>CurHP</sub></em>가 일정량 회복되고 공격력 <em>H<sub>ATK</sub></em>도 일정량만큼 증가됩니다. 회복된 생명력이 최대 생명력 <em>H<sub>MaxHP</sub></em>보다 큰 경우 용사의 현재 생명력 <em>H<sub>CurHP</sub></em>가 최대 생명력 <em>H<sub>MaxHP</sub></em>&nbsp;같아집니다.</p>
<p>용사는 던전으로 향하기 전에 만반의 준비를 하고 있습니다. 용사는 수련을 하면 최대 생명력 <em>H<sub>MaxHP</sub></em>를 늘릴 수 있는데 얼마나 수련해야 할지 고민입니다.</p>
<p>용사는 <em>N</em>번 방에 있는 용을 쓰러트리기 위한 최소의 <em>H<sub>MaxHP</sub></em>를 여러분이 계산해주면 좋겠다고 합니다.</p>
</article>
<article class="section">
<h2>입력</h2>
<p>첫 번째 줄에 방의 개수 <em>N&nbsp;</em>(1 &le;&nbsp;<em>N<sub>&nbsp;&nbsp;</sub></em>&le; 123,456)&nbsp;과 용사의 초기 공격력&nbsp;<em>H<sub>ATK</sub></em>&nbsp;(1 &le;&nbsp;<em>H<sub>ATK&nbsp;&nbsp;</sub></em>&le;&nbsp;1,000,000) 가 주어집니다.</p>
<p><em>i</em>+1번째 줄엔 <em>i</em>번째 방의 정보를 나타내는 세개의 정수 <em>t<sub><span style="font-size: 10.8333px;">i</span></sub></em>, <em>a<sub>i</sub></em>, <em>h<sub>i</sub></em>&nbsp;(<em>t<sub><span style="font-size: 10.8333px;">i</span></sub></em> &isin; {1, 2}, 1 &le; <em>a<sub>i</sub></em>, <em>h<sub>i&nbsp;&nbsp;</sub></em>&le;&nbsp;1,000,000) 가&nbsp;주어집니다.&nbsp;</p>
<p><em>t<sub><span style="font-size: 10.8333px;">i</span></sub></em>가 1인 경우 공격력이 <em>a<sub>i</sub></em>이고 생명력이 <em>h<sub>i</sub></em>인 몬스터가 있음을 나타내고,&nbsp;<em>t<sub><span style="font-size: 10.8333px;">i</span></sub></em>가 2인 경우 용사의 공격력 <em>H<sub>ATK</sub></em>&nbsp;<em>a<sub>i</sub></em>만큼 증가시켜주고 용사의 현재 생명력 <em>H<sub>CurHP</sub></em>&nbsp;<em>h<sub>i</sub></em>만큼 회복시켜주는 포션이 있음을 나타냅니다.</p>
</article>
<article class="section">
<h2>출력</h2>
<p>용사가 <em>N</em>번째 방에 있는 용을 쓰러트리기 위한 최소의 <em>H<sub>MaxHP</sub></em>를 출력합니다.</p>
</article>
<article class="section">
<h2>예제 입력 1 복사</h2>
<pre class="sampledata" id="sample-input-1">3 3
1 1 20
2 3 10
1 3 100</pre>
</article>
<article class="section">
<h2>예제 입력 2 복사</h2>
<pre class="sampledata" id="sample-input-2">1 1
1 1000000 1000000</pre>
</article>
<article class="section">
<h2>예제 출력 1 복사</h2>
<pre class="sampledata" id="sample-output-1">49</pre>
</article>
<article class="section">
<h2>예제 출력 2 복사</h2>
<pre class="sampledata" id="sample-output-2">999999000001</pre>
</article>
</main>
</body>
</html>