Files
PAT/source/html/a1144.html
T

14 lines
1.7 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
The Missing Number
<div class="ques-view"><p>Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.</p>
<h3 id="input-specification-">Input Specification:</h3>
<p>Each input file contains one test case. For each case, the first line gives a positive integer N (<span class="katex"><span class="katex-mathml"><math><mrow><mo>≤</mo><mn>1</mn><msup><mn>0</mn><mn>5</mn></msup></mrow>\le 10^5</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.8141079999999999em;"></span><span class="strut bottom" style="height:0.950078em;vertical-align:-0.13597em;"></span><span class="base textstyle uncramped"><span class="mrel">≤</span><span class="mord mathrm">1</span><span class="mord"><span class="mord mathrm">0</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 mathrm mtight">5</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></span></span>). Then N integers are given in the next line, separated by spaces. All the numbers are in the range of <strong>int</strong>.</p>
<h3 id="output-specification-">Output Specification:</h3>
<p>Print in a line the smallest positive integer that is missing from the input list.</p>
<h3 id="sample-input-">Sample Input:</h3>
<pre><code class="lang-in">10
5 -25 9 6 1 3 4 2 5 17
</code></pre>
<h3 id="sample-output-">Sample Output:</h3>
<pre><code class="lang-out">7
</code></pre>
</div>