163 lines
6.1 KiB
HTML
163 lines
6.1 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 1996 - 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>다들 windows에서 지원하는 지뢰 찾기 게임을 한번쯤은 해 보았을 것이다. 특히 동호는 지뢰찾기의 매니아로 알려져 있다. 지뢰 찾기 map은 N*N의 정사각형 모양으로 각 칸에는 숫자가 들어가 있거나 지뢰가 들어가 있다. 빈 칸에는 숫자 0이 들어있다고 생각하자.</p>
|
|
|
|
<p>map의 어떤 칸에 적혀 있는 숫자는, 그 칸과 인접해 있는 여덟 개의 칸 중에서 지뢰가 들어 있는 칸이 몇 개인지를 나타내 준다. 물론 인접한 칸이 map 내부에 있는 경우에 대해서만 생각하면 된다. 예제를 보면 더 잘 이해할 수 있을 것이다.</p>
|
|
|
|
<p>이번 문제는 조금 업그레이드 된 지뢰 찾기로, 한 칸에 한 개의 지뢰가 있는 것이 아니고, 한 칸에 여러 개(1 이상 9 이하)의 지뢰가 묻혀 있는 게임이다. 따라서 map의 어떤 칸에 적혀 있는 숫자는, 그 칸과 인접해 있는 여덟 개의 칸들에 들어 있는 지뢰의 총 개수가 된다.</p>
|
|
|
|
<p>이미 windows 지뢰찾기 같은 것을 마스터한 영식이는, map에서 지뢰에 대한 정보만이 주어졌을 때, 영식이는 map을 완성하고 싶다고 한다. N과 지뢰의 위치가 주어졌을 때, 영식이를 도와서 지뢰 찾기 map을 완성하는 프로그램을 작성하시오.</p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>입력</h2>
|
|
<p>첫째 줄에 N(1 ≤ N ≤ 1,000)이 주어진다. 다음 N개의 줄에는 지뢰 찾기 map에 대한 정보가 주어지는데 '.' 또는 숫자로 이루어진 문자열이 들어온다. '.'는 지뢰가 없는 것이고 숫자는 지뢰가 있는 경우로 그 칸의 지뢰의 개수이다. 한 줄은 N개의 문자로 이루어져 있다.</p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>출력</h2>
|
|
<p>N개의 줄에 걸쳐서 완성된 지뢰 찾기 map을 출력한다. 지뢰는 '*'로 출력하며. 10 이상인 경우는 'M'(Many)으로 출력하면 된다. map은 숫자 또는 'M' 또는 '*'로만 이루어져 있어야 한다.</p>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 입력 1 복사</h2>
|
|
<pre class="sampledata" id="sample-input-1">5
|
|
1....
|
|
..3..
|
|
.....
|
|
.4...
|
|
...9.
|
|
</pre>
|
|
</article>
|
|
<article class="section">
|
|
<h2>예제 출력 1 복사</h2>
|
|
<pre class="sampledata" id="sample-output-1">*4330
|
|
14*30
|
|
47730
|
|
4*M99
|
|
44M*9
|
|
</pre>
|
|
</article>
|
|
</main>
|
|
</body>
|
|
</html>
|