mirror of
https://github.com/xlucn/PAT.git
synced 2026-11-05 06:37:35 +08:00
39 lines
5.6 KiB
HTML
39 lines
5.6 KiB
HTML
万绿丛中一点红
|
||
<div class="ques-view"><p>对于计算机而言,颜色不过是像素点对应的一个 24 位的数值。现给定一幅分辨率为 <span class="katex"><span class="katex-mathml"><math><mrow><mi>M</mi><mo>×</mo><mi>N</mi></mrow>M\times N</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.76666em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">M</span><span class="mbin">×</span><span class="mord mathit" style="margin-right:0.10903em;">N</span></span></span></span> 的画,要求你找出万绿丛中的一点红,即有独一无二颜色的那个像素点,并且该点的颜色与其周围 8 个相邻像素的颜色差充分大。</p>
|
||
<h3 id="-">输入格式:</h3>
|
||
<p>输入第一行给出三个正整数,分别是 <span class="katex"><span class="katex-mathml"><math><mrow><mi>M</mi></mrow>M</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">M</span></span></span></span> 和 <span class="katex"><span class="katex-mathml"><math><mrow><mi>N</mi></mrow>N</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">N</span></span></span></span>(<span class="katex"><span class="katex-mathml"><math><mrow><mo>≤</mo></mrow>\le</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.63597em;"></span><span class="strut bottom" style="height:0.7719400000000001em;vertical-align:-0.13597em;"></span><span class="base textstyle uncramped"><span class="mrel">≤</span></span></span></span> 1000),即图像的分辨率;以及 TOL,是所求像素点与相邻点的颜色差阈值,色差超过 TOL 的点才被考虑。随后 <span class="katex"><span class="katex-mathml"><math><mrow><mi>N</mi></mrow>N</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">N</span></span></span></span> 行,每行给出 <span class="katex"><span class="katex-mathml"><math><mrow><mi>M</mi></mrow>M</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.10903em;">M</span></span></span></span> 个像素的颜色值,范围在 <span class="katex"><span class="katex-mathml"><math><mrow><mo>[</mo><mn>0</mn><mo separator="true">,</mo><msup><mn>2</mn><mrow><mn>2</mn><mn>4</mn></mrow></msup><mo>)</mo></mrow>[0, 2^{24})</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.8141079999999999em;"></span><span class="strut bottom" style="height:1.064108em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">[</span><span class="mord mathrm">0</span><span class="mpunct">,</span><span class="mord"><span class="mord mathrm">2</span><span class="msupsub"><span class="vlist"><span style="top:-0.363em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;"></span></span><span class="reset-textstyle scriptstyle uncramped mtight"><span class="mord scriptstyle uncramped mtight"><span class="mord mathrm mtight">2</span><span class="mord mathrm mtight">4</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;"></span></span></span></span></span></span><span class="mclose">)</span></span></span></span> 内。所有同行数字间用空格或 TAB 分开。</p>
|
||
<h3 id="-">输出格式:</h3>
|
||
<p>在一行中按照 <code>(x, y): color</code> 的格式输出所求像素点的位置以及颜色值,其中位置 <code>x</code> 和 <code>y</code> 分别是该像素在图像矩阵中的列、行编号(从 1 开始编号)。如果这样的点不唯一,则输出 <code>Not Unique</code>;如果这样的点不存在,则输出 <code>Not Exist</code>。</p>
|
||
<h3 id="-1-">输入样例 1:</h3>
|
||
<pre><code class="lang-in">8 6 200
|
||
0 0 0 0 0 0 0 0
|
||
65280 65280 65280 16711479 65280 65280 65280 65280
|
||
16711479 65280 65280 65280 16711680 65280 65280 65280
|
||
65280 65280 65280 65280 65280 65280 165280 165280
|
||
65280 65280 16777015 65280 65280 165280 65480 165280
|
||
16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215
|
||
</code></pre>
|
||
<h3 id="-1-">输出样例 1:</h3>
|
||
<pre><code class="lang-out">(5, 3): 16711680
|
||
</code></pre>
|
||
<h3 id="-2-">输入样例 2:</h3>
|
||
<pre><code class="lang-in">4 5 2
|
||
0 0 0 0
|
||
0 0 3 0
|
||
0 0 0 0
|
||
0 5 0 0
|
||
0 0 0 0
|
||
</code></pre>
|
||
<h3 id="-2-">输出样例 2:</h3>
|
||
<pre><code class="lang-out">Not Unique
|
||
</code></pre>
|
||
<h3 id="-3-">输入样例 3:</h3>
|
||
<pre><code class="lang-in">3 3 5
|
||
1 2 3
|
||
3 4 5
|
||
5 6 7
|
||
</code></pre>
|
||
<h3 id="-3-">输出样例 3:</h3>
|
||
<pre><code class="lang-out">Not Exist
|
||
</code></pre>
|
||
</div> |