<?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=1122_-_Babilon</id>
	<title>1122 - Babilon - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1122_-_Babilon"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1122_-_Babilon&amp;action=history"/>
	<updated>2026-05-01T10:56:43Z</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=1122_-_Babilon&amp;diff=4726&amp;oldid=prev</id>
		<title>Tamas Claudia at 16:33, 26 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1122_-_Babilon&amp;diff=4726&amp;oldid=prev"/>
		<updated>2023-04-26T16:33:40Z</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 16:33, 26 April 2023&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-l28&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&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;; Ecran&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;; Ecran&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;: Datele sunt introduse corect.&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;: Datele sunt introduse corect.&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;; babilon.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in&lt;/del&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;; babilon.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;out&lt;/ins&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;: 3&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;: 3&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;===Exemplul 2===&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;===Exemplul 2===&lt;/div&gt;&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-l37&quot;&gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&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;; Ecran&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;; Ecran&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;: Datele sunt introduse corect.&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;: Datele sunt introduse corect.&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;; babilon.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in&lt;/del&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;; babilon.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;out&lt;/ins&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;: 7213&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;: 7213&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;===Exemplul 3===&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;===Exemplul 3===&lt;/div&gt;&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-l46&quot;&gt;Line 46:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 46:&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;; Ecran&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;; Ecran&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;: Datele sunt introduse corect.&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;: Datele sunt introduse corect.&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;; babilon.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;in&lt;/del&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;; babilon.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;out&lt;/ins&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;: 11541&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;: 11541&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;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;/table&gt;</summary>
		<author><name>Tamas Claudia</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1122_-_Babilon&amp;diff=4722&amp;oldid=prev</id>
		<title>Tamas Claudia: Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/1122/babilon] ---- == Cerinţa == Dându-se un număr natural &#039;&#039;&#039;numar&#039;&#039;&#039; și un șir de &#039;&#039;&#039;numar&#039;&#039;&#039; cifre din mulțimea {1, 2, 3}, reprezentând codificarea scrierii babiloniene a unui număr natural, să se determine: a) numărul maxim de cifre 1 aflate pe poziții consecutive în codificarea scrierii babiloniene date; b) numărul natural din sistemul zecimal corespunzător scrierii babiloniene date. == Date de intrare == Fișierul de...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1122_-_Babilon&amp;diff=4722&amp;oldid=prev"/>
		<updated>2023-04-26T16:25:43Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/1122/babilon] ---- == Cerinţa == Dându-se un număr natural &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; și un șir de &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; cifre din mulțimea {1, 2, 3}, reprezentând codificarea scrierii babiloniene a unui număr natural, să se determine: a) numărul maxim de cifre 1 aflate pe poziții consecutive în codificarea scrierii babiloniene date; b) numărul natural din sistemul zecimal corespunzător scrierii babiloniene date. == Date de intrare == Fișierul de...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sursa: [https://www.pbinfo.ro/probleme/1122/babilon]&lt;br /&gt;
----&lt;br /&gt;
== Cerinţa ==&lt;br /&gt;
Dându-se un număr natural &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; și un șir de &amp;#039;&amp;#039;&amp;#039;numar&amp;#039;&amp;#039;&amp;#039; cifre din mulțimea {1, 2, 3}, reprezentând codificarea scrierii babiloniene a unui număr natural, să se determine:&lt;br /&gt;
a) numărul maxim de cifre 1 aflate pe poziții consecutive în codificarea scrierii babiloniene date;&lt;br /&gt;
b) numărul natural din sistemul zecimal corespunzător scrierii babiloniene date.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Fișierul de intrare &amp;#039;&amp;#039;&amp;#039;babilon.in&amp;#039;&amp;#039;&amp;#039; conține:&lt;br /&gt;
* pe prima linie un număr natural p ( 1 ≤ p ≤ 2 );&lt;br /&gt;
* pe a doua linie un număr natural n;&lt;br /&gt;
* pe a treia linie n cifre separate prin câte un spațiu, reprezentând codificarea scrierii babiloniene a unui număr natural.&lt;br /&gt;
== Date de ieșire == &lt;br /&gt;
Dacă datele sunt introduse corect, pe ecran se va afișa: &amp;#039;&amp;#039;&amp;#039;&amp;quot;Datele sunt introduse corect.&amp;quot;&amp;#039;&amp;#039;&amp;#039;, apoi: * dacă valoarea lui p este 1, atunci se va rezolva numai punctul a) din cerință. În acest caz, fişierul de ieşire &amp;#039;&amp;#039;&amp;#039;babilon.out&amp;#039;&amp;#039;&amp;#039; va conţine pe prima linie un număr natural reprezentând numărul maxim de cifre 1 aflate pe poziții consecutive în codificarea scrierii babiloniene date.&lt;br /&gt;
* dacă valoarea lui p este 2, atunci se va rezolva numai punctul b) din cerință. În acest caz, fişierul de ieşire &amp;#039;&amp;#039;&amp;#039;babilon.out&amp;#039;&amp;#039;&amp;#039; va conţine pe prima linie numărul natural corespunzător scrierii babiloniene date. &lt;br /&gt;
În caz contrar, pe ecran se va afișa: &amp;#039;&amp;#039;&amp;#039;&amp;quot;Datele nu au fost introduse corect.&amp;quot;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Restricţii şi precizări ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2 ≤ n ≤ 109;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* se garantează faptul că numărul de cifre al rezultatului de la punctul b) (numărul zecimal) este mai mic decât &amp;#039;&amp;#039;&amp;#039;20&amp;#039;&amp;#039;&amp;#039;;&lt;br /&gt;
* 30% din teste vor avea pe prima linie valoarea 1, iar restul de 70% din teste vor avea pe prima linie valoarea 2.&lt;br /&gt;
&lt;br /&gt;
== Exemple ==&lt;br /&gt;
===Exemplul 1===&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 1&lt;br /&gt;
: 8&lt;br /&gt;
: 1 1 3 2 1 1 1 2&lt;br /&gt;
; Ecran&lt;br /&gt;
: Datele sunt introduse corect.&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 3&lt;br /&gt;
===Exemplul 2===&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 2&lt;br /&gt;
: 7&lt;br /&gt;
: 1 1 3 2 1 1 1&lt;br /&gt;
; Ecran&lt;br /&gt;
: Datele sunt introduse corect.&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 7213&lt;br /&gt;
===Exemplul 3===&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 2&lt;br /&gt;
: 9&lt;br /&gt;
: 1 1 1 2 1 1 2 2 1&lt;br /&gt;
; Ecran&lt;br /&gt;
: Datele sunt introduse corect.&lt;br /&gt;
; babilon.in&lt;br /&gt;
: 11541&lt;br /&gt;
&lt;br /&gt;
== Rezolvare == &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
# 1122&lt;br /&gt;
&lt;br /&gt;
def verificare_restricții(p, n, cifre):&lt;br /&gt;
    if p not in (1, 2):&lt;br /&gt;
        return False&lt;br /&gt;
    if not (2 &amp;lt;= n &amp;lt;= 10**9):&lt;br /&gt;
        return False&lt;br /&gt;
    for cifra in cifre:&lt;br /&gt;
        if cifra not in (1, 2, 3):&lt;br /&gt;
            return False&lt;br /&gt;
    return True&lt;br /&gt;
&lt;br /&gt;
def maxim_cifre_1_consecutive(n, cifre):&lt;br /&gt;
    max_consecutive = 0&lt;br /&gt;
    consecutive = 0&lt;br /&gt;
    for cifra in cifre:&lt;br /&gt;
        if cifra == 1:&lt;br /&gt;
            consecutive += 1&lt;br /&gt;
            max_consecutive = max(max_consecutive, consecutive)&lt;br /&gt;
        else:&lt;br /&gt;
            consecutive = 0&lt;br /&gt;
    return max_consecutive&lt;br /&gt;
&lt;br /&gt;
def numar_babilonian_to_decimal(n, cifre):&lt;br /&gt;
    numar = 0&lt;br /&gt;
    putere = 1&lt;br /&gt;
    for i in range(n-1, -1, -1):&lt;br /&gt;
        numar += cifre[i] * putere&lt;br /&gt;
        putere *= 60 if i &amp;gt; 0 and cifre[i-1] == 2 else 1&lt;br /&gt;
    return numar&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;#039;__main__&amp;#039;:&lt;br /&gt;
    with open(&amp;quot;babilon.in&amp;quot;) as f:&lt;br /&gt;
        p = int(f.readline().strip())&lt;br /&gt;
        n = int(f.readline().strip())&lt;br /&gt;
        cifre = list(map(int, f.readline().strip().split()))&lt;br /&gt;
&lt;br /&gt;
    if verificare_restricții(p, n, cifre):&lt;br /&gt;
        print(&amp;quot;Datele sunt introduse corect.&amp;quot;)&lt;br /&gt;
        if p == 1:&lt;br /&gt;
            rezultat = maxim_cifre_1_consecutive(n, cifre)&lt;br /&gt;
            with open(&amp;quot;babilon.out&amp;quot;, &amp;quot;w&amp;quot;) as g:&lt;br /&gt;
                g.write(str(rezultat))&lt;br /&gt;
        else:&lt;br /&gt;
            rezultat = numar_babilonian_to_decimal(n, cifre)&lt;br /&gt;
            with open(&amp;quot;babilon.out&amp;quot;, &amp;quot;w&amp;quot;) as g:&lt;br /&gt;
                g.write(str(rezultat))&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele nu au fost introduse corect.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Explicație rezolvare ==&lt;br /&gt;
&lt;br /&gt;
Funcția &amp;#039;&amp;#039;&amp;#039;verificare_restricții(p, n, cifre)&amp;#039;&amp;#039;&amp;#039; primește trei argumente: p care este un întreg ce poate fi 1 sau 2, n care este un întreg cuprins între 2 și 10^9 și cifre care este o listă de întregi ce conține cifrele reprezentării în baza 60 a unui număr babilonian. Funcția verifică dacă valorile primite sunt conform restricțiilor și returnează True dacă sunt și False în caz contrar. Mai precis, verifică dacă p este 1 sau 2, dacă n este între 2 și 10^9 și dacă toate cifrele din cifre sunt 1, 2 sau 3.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Funcția &amp;#039;&amp;#039;&amp;#039;maxim_cifre_1_consecutive(n, cifre)&amp;#039;&amp;#039;&amp;#039; primește doi argumente: n și cifre, aceeași ca în funcția precedentă. Funcția calculează lungimea celei mai lungi secvențe de cifre 1 consecutive din cifre și o returnează.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Funcția &amp;#039;&amp;#039;&amp;#039;numar_babilonian_to_decimal(n, cifre)&amp;#039;&amp;#039;&amp;#039; primește doi argumente: n și cifre, aceeași ca în funcția precedentă. Funcția convertește numărul babilonian reprezentat de cifre în baza 60 într-un număr zecimal și îl returnează.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;În main se apelează funcțiile corespunzătoare în funcție de valorile primite prin citirea fișierului &amp;#039;&amp;#039;&amp;#039;&amp;quot;babilon.in&amp;quot;&amp;#039;&amp;#039;&amp;#039;. În primul rând se verifică dacă valorile primite sunt conform restricțiilor, apoi se calculează rezultatul corespunzător. Dacă p este 1 se apelează funcția &amp;#039;&amp;#039;&amp;#039;maxim_cifre_1_consecutive&amp;#039;&amp;#039;&amp;#039;, altfel se apelează funcția &amp;#039;&amp;#039;&amp;#039;numar_babilonian_to_decimal&amp;#039;&amp;#039;&amp;#039;. Rezultatul este scris în fișierul &amp;#039;&amp;#039;&amp;#039;&amp;quot;babilon.out&amp;quot;&amp;#039;&amp;#039;&amp;#039;. Dacă valorile primite nu sunt conform restricțiilor se afișează un mesaj corespunzător.&lt;/div&gt;</summary>
		<author><name>Tamas Claudia</name></author>
	</entry>
</feed>