<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1085_-_Loto</id>
	<title>1085 - Loto - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1085_-_Loto"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1085_-_Loto&amp;action=history"/>
	<updated>2026-05-02T07:53:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1085_-_Loto&amp;diff=9639&amp;oldid=prev</id>
		<title>Raul at 14:52, 13 February 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1085_-_Loto&amp;diff=9639&amp;oldid=prev"/>
		<updated>2024-02-13T14:52:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:52, 13 February 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l27&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Lipește codul aici ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Lipește codul aici ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;python&lt;/del&gt;&quot; line=&quot;1&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;python2&lt;/ins&gt;&quot; line=&quot;1&quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;n = int(input())&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;n = int(input())&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;a = [False] * 10001&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;a = [False] * 10001&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raul</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1085_-_Loto&amp;diff=9638&amp;oldid=prev</id>
		<title>Raul: Pagină nouă: La Loteria Naţională există &lt;code&gt;N&lt;/code&gt; bile inscripţionate cu numere naturale, nenule, distincte de cel mult &lt;code&gt;4&lt;/code&gt; cifre. Şeful de la loterie primeşte o cutie în care se află cele &lt;code&gt;6&lt;/code&gt; bile extrase la ultima rundă, restul bilelor neextrase fiind puse într-un seif. Deoarece are o fire poznaşă, el scoate din cutie bila pe care este înscris numărul cel mai mic şi o păstrează în buzunarul hainei sale. În locul ei va pune o bilă neextras...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1085_-_Loto&amp;diff=9638&amp;oldid=prev"/>
		<updated>2024-02-13T14:51:03Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: La Loteria Naţională există &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; bile inscripţionate cu numere naturale, nenule, distincte de cel mult &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; cifre. Şeful de la loterie primeşte o cutie în care se află cele &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt; bile extrase la ultima rundă, restul bilelor neextrase fiind puse într-un seif. Deoarece are o fire poznaşă, el scoate din cutie bila pe care este înscris numărul cel mai mic şi o păstrează în buzunarul hainei sale. În locul ei va pune o bilă neextras...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;La Loteria Naţională există &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; bile inscripţionate cu numere naturale, nenule, distincte de cel mult &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt; cifre. Şeful de la loterie primeşte o cutie în care se află cele &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt; bile extrase la ultima rundă, restul bilelor neextrase fiind puse într-un seif. Deoarece are o fire poznaşă, el scoate din cutie bila pe care este înscris numărul cel mai mic şi o păstrează în buzunarul hainei sale. În locul ei va pune o bilă neextrasă, aflată în seif,  având numărul cel mai apropiat de aceasta. Apoi continuă operaţia şi scoate din cutie şi bila pe care este înscris numărul maxim extras iniţial, pe care o va pune în celălalt buzunar al său. De asemenea o va înlocui cu o altă bilă neextrasă iniţial,  aflată în seif, având numărul cel mai apropiat de aceasta.&lt;br /&gt;
&lt;br /&gt;
= Cerinţă =&lt;br /&gt;
Realizaţi un program care afişează în ordine crescătoare numerele de pe bilele aflate în cutie după modificările făcute de şef.&lt;br /&gt;
&lt;br /&gt;
= Date de intrare =&lt;br /&gt;
Fișierul de intrare &amp;lt;code&amp;gt;loto.in&amp;lt;/code&amp;gt; conține numărul natural &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt;, pe a doua linie cele &amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; numere naturale scrise pe bile, iar pe a treia linie cele 6 numere naturale scrise pe bilele extrase de angajaţii loteriei. Valorile scrise pe aceeaşi linie sunt separate prin spaţii.&lt;br /&gt;
&lt;br /&gt;
= Date de ieșire =&lt;br /&gt;
Fișierul de ieșire &amp;lt;code&amp;gt;loto.out&amp;lt;/code&amp;gt; se vor afişa pe prima linie, separate prin câte un spaţiu, cele 6 numere obţinute în cutie după modificările făcute de şef, în ordine crescătoare.&lt;br /&gt;
&lt;br /&gt;
= Restricții și precizări =&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;8 &amp;lt; N &amp;lt; 1000&amp;lt;/code&amp;gt;&lt;br /&gt;
* Dacă o bilă poate fi înlocuită cu două bile la fel de apropiate de ea, atunci aceasta se va înlocui cu bila având numărul mai mare.&lt;br /&gt;
* Pentru datele de test, atât bila cu numărul cel mai mic, cât şi bila cu numărul cel mai mare pot fi înlocuite cu alte bile.&lt;br /&gt;
&lt;br /&gt;
= Exemplul 1 =&lt;br /&gt;
&amp;lt;code&amp;gt;loto.in&amp;lt;/code&amp;gt;&lt;br /&gt;
 10&lt;br /&gt;
 231 212 32 123 453 675 1321 54 67 567&lt;br /&gt;
 212 32 67 567 675 1321&lt;br /&gt;
&amp;lt;code&amp;gt;loto.out&amp;lt;/code&amp;gt;&lt;br /&gt;
 54 67 212 453 567 675&lt;br /&gt;
&lt;br /&gt;
== Încărcare soluție ==&lt;br /&gt;
&lt;br /&gt;
=== Lipește codul aici ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
n = int(input())&lt;br /&gt;
a = [False] * 10001&lt;br /&gt;
b = [0] * 6&lt;br /&gt;
&lt;br /&gt;
for _ in range(n):&lt;br /&gt;
    x = int(input())&lt;br /&gt;
    a[x] = True&lt;br /&gt;
&lt;br /&gt;
max_value = 0&lt;br /&gt;
min_value = 10000&lt;br /&gt;
mx = 0&lt;br /&gt;
mn = 0&lt;br /&gt;
&lt;br /&gt;
for i in range(6):&lt;br /&gt;
    b[i] = int(input())&lt;br /&gt;
    a[b[i]] = False&lt;br /&gt;
    if b[i] &amp;lt; min_value:&lt;br /&gt;
        min_value = b[i]&lt;br /&gt;
        mn = i&lt;br /&gt;
    if b[i] &amp;gt; max_value:&lt;br /&gt;
        max_value = b[i]&lt;br /&gt;
        mx = i&lt;br /&gt;
&lt;br /&gt;
i = min_value&lt;br /&gt;
j = min_value&lt;br /&gt;
while not (a[i] or a[j]):&lt;br /&gt;
    if i &amp;lt; 10000:&lt;br /&gt;
        i += 1&lt;br /&gt;
    if j &amp;gt; 1:&lt;br /&gt;
        j -= 1&lt;br /&gt;
&lt;br /&gt;
if a[i]:&lt;br /&gt;
    b[mn] = i&lt;br /&gt;
else:&lt;br /&gt;
    b[mn] = j&lt;br /&gt;
a[b[mn]] = False&lt;br /&gt;
&lt;br /&gt;
i = max_value&lt;br /&gt;
j = max_value&lt;br /&gt;
while not (a[i] or a[j]):&lt;br /&gt;
    if i &amp;lt; 10000:&lt;br /&gt;
        i += 1&lt;br /&gt;
    if j &amp;gt; 1:&lt;br /&gt;
        j -= 1&lt;br /&gt;
&lt;br /&gt;
if a[i]:&lt;br /&gt;
    b[mx] = i&lt;br /&gt;
else:&lt;br /&gt;
    b[mx] = j&lt;br /&gt;
&lt;br /&gt;
# Sorting the array b&lt;br /&gt;
b.sort()&lt;br /&gt;
&lt;br /&gt;
for i in range(5):&lt;br /&gt;
    print(b[i], end=&amp;#039; &amp;#039;)&lt;br /&gt;
print(b[5])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Raul</name></author>
	</entry>
</feed>