0
0 комментариев
<span class="sh_keyword">var</span> n<span class="sh_symbol">,</span>i<span class="sh_symbol">,</span>j<span class="sh_symbol">,</span>k<span class="sh_symbol">,</span> c<span class="sh_symbol">,</span> min<span class="sh_symbol">,</span> a<span class="sh_symbol">:</span> longint<span class="sh_symbol">;</span>
<span class="sh_keyword">begin</span>
<span class="sh_keyword">readln</span><span class="sh_symbol">(</span>n<span class="sh_symbol">);</span>
min <span class="sh_symbol">:=</span> <a href="tel:1000000001"><span class="sh_number">1000000001</span></a><span class="sh_symbol">;</span>
 k <span class="sh_symbol">:=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span>
 j <span class="sh_symbol">:=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span>
 c <span class="sh_symbol">:=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span>
<span class="sh_keyword">for</span> i <span class="sh_symbol">:=</span> <span class="sh_number">1</span> <span class="sh_keyword">to</span> n 
<span class="sh_keyword">do</span>
 <span class="sh_keyword">begin</span>
<span class="sh_keyword">readln</span><span class="sh_symbol">(</span>a<span class="sh_symbol">);</span>
<span class="sh_keyword">if</span> a <span class="sh_symbol">=</span> <span class="sh_number">0</span> <span class="sh_keyword">then</span> 
j <span class="sh_symbol">:=</span> i<span class="sh_symbol">;</span>
 <span class="sh_keyword">if</span> a <span class="sh_keyword">mod</span> <span class="sh_number">2</span> <span class="sh_symbol"><></span> <span class="sh_number">0</span>
 <span class="sh_keyword">then</span> <span class="sh_keyword">begin</span>
c <span class="sh_symbol">:=</span> c <span class="sh_symbol">+</span> <span class="sh_number">1</span><span class="sh_symbol">;</span> 
<span class="sh_keyword">if</span> a <span class="sh_symbol"><</span> min
 <span class="sh_keyword">then</span> <span class="sh_keyword">begin</span>
min <span class="sh_symbol">:=</span> a<span class="sh_symbol">;</span> 
k <span class="sh_symbol">:=</span> i<span class="sh_symbol">;</span>
 <span class="sh_keyword">end</span> <span class="sh_symbol">;</span>
<span class="sh_keyword">end</span><span class="sh_symbol">;</span>
 <span class="sh_keyword">end</span><span class="sh_symbol">;</span>
<span class="sh_keyword">for</span> i<span class="sh_symbol">:=</span><span class="sh_number">1</span> <span class="sh_keyword">to</span> n 
<span class="sh_keyword">do</span>
<span class="sh_keyword">if</span> <span class="sh_symbol">(</span>i <span class="sh_symbol"><></span> j<span class="sh_symbol">)</span> <span class="sh_keyword">and</span> <span class="sh_symbol">((</span>c <span class="sh_keyword">mod</span> <span class="sh_number">2</span> <span class="sh_symbol"><></span> <span class="sh_number">0</span><span class="sh_symbol">)</span> <span class="sh_keyword">or</span> <span class="sh_symbol">(</span>i <span class="sh_symbol"><></span> k<span class="sh_symbol">))</span> <span class="sh_keyword">then</span> <span class="sh_keyword">write</span><span class="sh_symbol">(</span>i<span class="sh_symbol">,</span> <span class="sh_string_pasc">' '</span><span class="sh_symbol">);</span>
<span class="sh_keyword">end</span><span class="sh_symbol">.</span>

Добавить комментарий