<?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=0161_-_inlocuire</id>
	<title>0161 - inlocuire - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=0161_-_inlocuire"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;action=history"/>
	<updated>2026-05-01T03:42:32Z</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=0161_-_inlocuire&amp;diff=4502&amp;oldid=prev</id>
		<title>Csatari Mălina: /* Exemplul 2 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;diff=4502&amp;oldid=prev"/>
		<updated>2023-04-26T10:58:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Exemplul 2&lt;/span&gt;&lt;/span&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 10:58, 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-l25&quot;&gt;Line 25:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 25:&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;; Intrare&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;; Intrare&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;: 1234&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;: 1234&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: 1 2 3&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;; Ieșire&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;; Ieșire&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 nu corespund restricțiilor impuse.&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 nu corespund restricțiilor impuse.&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;&amp;lt;br&amp;gt;&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;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&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;== Rezolvare ==  &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;== Rezolvare ==  &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;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&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;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Csatari Mălina</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;diff=4501&amp;oldid=prev</id>
		<title>Csatari Mălina at 10:58, 26 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;diff=4501&amp;oldid=prev"/>
		<updated>2023-04-26T10:58:03Z</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 10:58, 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-l49&quot;&gt;Line 49:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 49:&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;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; 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;def citire_conform_restrictiilor():&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;def citire_conform_restrictiilor(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vector, n&lt;/ins&gt;):&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    n = int(input())&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;     if n &amp;lt; 1 or n &amp;gt; 200:&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;     if n &amp;lt; 1 or n &amp;gt; 200:&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;         print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&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;         print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&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;         exit()&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;         exit()&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    vector = list(map(int, input().split()))&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;     for x in vector:&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;     for x in vector:&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;         if x &amp;gt;= 1000:&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;         if x &amp;gt;= 1000:&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-l70&quot;&gt;Line 70:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&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;         exit()&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;         exit()&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;     print(&amp;quot;Datele sunt introduse corect.&amp;quot;)&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;     print(&amp;quot;Datele sunt introduse corect.&amp;quot;)&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    return vector, n&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&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;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;if __name__ == &amp;#039;__main__&amp;#039;:&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;if __name__ == &amp;#039;__main__&amp;#039;:&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;     vector, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n = &lt;/del&gt;citire_conform_restrictiilor()&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    n = int(input())&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;     vector &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= list(map(int&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;input().split()))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    &lt;/ins&gt;citire_conform_restrictiilor(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vector, n&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;     inlocuire_el_nule_cu_media_el_nenule(vector, n)&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;     inlocuire_el_nule_cu_media_el_nenule(vector, n)&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;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l92&quot;&gt;Line 92:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&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;&amp;lt;/syntaxhighlight&amp;gt;&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;&amp;lt;/syntaxhighlight&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;== Explicație rezolvare==&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;== Explicație rezolvare==&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;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;   Acest cod conține o funcție &lt;/del&gt;inlocuire_el_nule_cu_media_el_nenule &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;care primește ca argumente un &lt;/del&gt;vector și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;dimensiunea sa și îndeplinește următoarele acțiuni:&amp;lt;br&amp;gt;-&amp;gt; calculează suma și numărul de elemente nenule din &lt;/del&gt;vector, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;folosind o buclă for și o structură condițională &lt;/del&gt;if&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt;-&amp;gt; calculează media aritmetică a elementelor nenule din vector&amp;lt;br&amp;gt;-&amp;gt; înlocuiește toate elementele nule din vector &lt;/del&gt;cu &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;media aritmetică &lt;/del&gt;a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;elementelor nenule din &lt;/del&gt;vector&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt;-&amp;gt; afișează vectorul inlocuit&lt;/del&gt;&amp;lt;br&amp;gt;   &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;De asemenea&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;codul conține și o funcție citire_conform_restrictiilor care primește &lt;/del&gt;ca &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;input de la utilizator o dimensiune &lt;/del&gt;n și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;un &lt;/del&gt;vector &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;de n elemente &lt;/del&gt;și verifică dacă acestea îndeplinesc anumite restricții, precum:&amp;lt;br&amp;gt;-&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;dimensiunea vectorului &lt;/del&gt;n trebuie să fie între 1 și 200&amp;lt;br&amp;gt;-&amp;gt; fiecare element al vectorului trebuie să fie mai mic decât 1000&amp;lt;br&amp;gt;-&amp;gt; dimensiunea vectorului n trebuie să fie egală cu numărul de elemente introduse de la tastatură&amp;lt;br&amp;gt;-&amp;gt; vectorul trebuie să conțină cel puțin un element nul.&amp;lt;br&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  Dacă restricțiile &lt;/del&gt;nu &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sunt respectate&lt;/del&gt;, programul afișează &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;un mesaj de eroare &lt;/del&gt;și se termină prin apelarea funcției exit(). În caz contrar, programul afișează un &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mesaj de confirmare și returnează vectorul &lt;/del&gt;și dimensiunea sa &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;către apelantul funcției.&lt;/del&gt;&amp;lt;br&amp;gt; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  În funcția principală __main__&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;se apelează funcția citire_conform_restrictiilor pentru &lt;/del&gt;a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;obține &lt;/del&gt;vectorul și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;dimensiunea sa &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apoi se apelează funcția inlocuire_el_nule_cu_media_el_nenule pentru a afișa &lt;/del&gt;vectorul &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;rezultat&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    Programul de mai sus definește două funcții, funcția &lt;/ins&gt;inlocuire_el_nule_cu_media_el_nenule&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;vector&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, n) &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;citire_conform_restrictiilor(&lt;/ins&gt;vector, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n), care sunt apelate în interiorul secțiunii &#039;&#039;&#039;&lt;/ins&gt;if &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__name__ == &#039;__main__&#039;:&#039;&#039;&#039; (linia 41) după citirea numărului n (linia 42, &lt;/ins&gt;cu &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;comanda input() și int() pentru &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;converti în număr) și celor n numere pe care le punem în vectorul &quot;&lt;/ins&gt;vector&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; (linia 43).&lt;/ins&gt;&amp;lt;br&amp;gt;   &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Funcția &#039;&#039;&#039;citire_conform_restrictiilor(vector&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n)&#039;&#039;&#039; are &lt;/ins&gt;ca &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;parametrii numărul &lt;/ins&gt;n și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vectorul &quot;&lt;/ins&gt;vector&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot; &lt;/ins&gt;și verifică dacă acestea îndeplinesc anumite restricții, precum:&amp;lt;br&amp;gt;-&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numărul &lt;/ins&gt;n trebuie să fie între 1 și 200&amp;lt;br&amp;gt;-&amp;gt; fiecare element al vectorului trebuie să fie mai mic decât 1000&amp;lt;br&amp;gt;-&amp;gt; dimensiunea vectorului n trebuie să fie egală cu numărul de elemente introduse de la tastatură&amp;lt;br&amp;gt;-&amp;gt; vectorul trebuie să conțină cel puțin un element nul &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(avem o variabilă nr_nule pe care o inițializăm cu 0 și parcurgem tot vectorul și dacă elementul este nul, creștem cu 1 această variabilă, iar dacă ea este 0 după terminarea buclei, înseamnă că vectorul nu are niciun element nul, adică nu respectă condițiile)&lt;/ins&gt;.&amp;lt;br&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; dacă oricare restricție &lt;/ins&gt;nu &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;este respectată&lt;/ins&gt;, programul afișează &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;Datele nu corespund restricțiilor impuse.&quot; &lt;/ins&gt;și se termină prin apelarea funcției exit(). În caz contrar, programul afișează &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;Datele sunt introduse corect.&quot; și programul poate continua.&amp;lt;br&amp;gt;   Funcția &#039;&#039;&#039;inlocuire_el_nule_cu_media_el_nenule(vector, n)&#039;&#039;&#039; primește ca argumente &lt;/ins&gt;un &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vector &lt;/ins&gt;și dimensiunea sa &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;și face următoarele acțiuni:&lt;/ins&gt;&amp;lt;br&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&amp;gt; calculează suma și numărul de elemente nenule din vector&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;folosind o buclă for și o structură condițională if;&amp;lt;br&amp;gt;-&amp;gt; calculează media aritmetică a elementelor nenule din vector pe care o punem în variabila media_el_nenule;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește toate elementele nule din vector cu media aritmetică a elementelor nenule din vector prin &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;parcurge &lt;/ins&gt;vectorul &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cu un for loop &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;verificarea elementelor dacă sunt nule &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;înlocuirea acestora cu variabila media_el_nenule;&amp;lt;br&amp;gt;-&amp;gt; afișează &lt;/ins&gt;vectorul &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;inlocuit cu ajutorul unui for loop, separate printr-un spațiu, conform problemei&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Csatari Mălina</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;diff=2007&amp;oldid=prev</id>
		<title>Csatari Mălina: Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/161/inlocuire 0161 - inlocuire] ---- == Cerinţa == Se dă un vector cu &#039;&#039;&#039;n&#039;&#039;&#039; elemente, numere naturale. Să se înlocuiască toate elementele nule din vector cu partea întreagă a mediei aritmetice a elementelor nenule din vector. == Date de intrare == Programul citește de la tastatură numărul &#039;&#039;&#039;n&#039;&#039;&#039;, iar apoi &#039;&#039;&#039;n&#039;&#039;&#039; numere naturale, separate prin spaţii, reprezentând elementele vectorului. == Date de ieșire ==  Dacă datele...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0161_-_inlocuire&amp;diff=2007&amp;oldid=prev"/>
		<updated>2023-03-31T09:42:31Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/161/inlocuire 0161 - inlocuire] ---- == Cerinţa == Se dă un vector cu &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; elemente, numere naturale. Să se înlocuiască toate elementele nule din vector cu partea întreagă a mediei aritmetice a elementelor nenule din vector. == Date de intrare == Programul citește de la tastatură numărul &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;, iar apoi &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale, separate prin spaţii, reprezentând elementele vectorului. == Date de ieșire ==  Dacă datele...&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/161/inlocuire 0161 - inlocuire]&lt;br /&gt;
----&lt;br /&gt;
== Cerinţa ==&lt;br /&gt;
Se dă un vector cu &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; elemente, numere naturale. Să se înlocuiască toate elementele nule din vector cu partea întreagă a mediei aritmetice a elementelor nenule din vector.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numărul &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;, iar apoi &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale, separate prin spaţii, reprezentând elementele vectorului.&lt;br /&gt;
== Date de ieșire == &lt;br /&gt;
Dacă datele sunt introduse corect, pe ecran se va afișa: &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;quot;Datele sunt introduse corect.&amp;quot;&amp;#039;&amp;#039;&amp;#039;, apoi pe un rând nou afișează elementele vectorului, după înlocuire, separate prin câte un spațiu. În cazul în care datele nu respectă restricțiile, se va afișa pe ecran: &amp;#039;&amp;#039;&amp;#039;&amp;quot;Datele nu corespund restricțiilor impuse.&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;1&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;200&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* elementele vectorului vor fi mai mici decât &amp;#039;&amp;#039;&amp;#039;1000&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* vectorul va conține cel puțin un element nenul&lt;br /&gt;
&lt;br /&gt;
== Exemple ==&lt;br /&gt;
===Exemplul 1===&lt;br /&gt;
; Intrare&lt;br /&gt;
: 5&lt;br /&gt;
: 0 2 0 4 5&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele sunt introduse corect.&lt;br /&gt;
: 3 2 3 4 5&lt;br /&gt;
===Exemplul 2===&lt;br /&gt;
; Intrare&lt;br /&gt;
: 1234&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele nu corespund restricțiilor impuse.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Rezolvare == &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
# 0161&lt;br /&gt;
&lt;br /&gt;
def inlocuire_el_nule_cu_media_el_nenule(vector, n):&lt;br /&gt;
    suma = 0&lt;br /&gt;
    nr_nenule = 0&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        if vector[i]:&lt;br /&gt;
            suma += vector[i]&lt;br /&gt;
            nr_nenule += 1&lt;br /&gt;
    media_el_nenule = suma // nr_nenule&lt;br /&gt;
&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        if not vector[i]:&lt;br /&gt;
            vector[i] = media_el_nenule&lt;br /&gt;
&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        print(vector[i], end=&amp;#039; &amp;#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def citire_conform_restrictiilor():&lt;br /&gt;
    n = int(input())&lt;br /&gt;
    if n &amp;lt; 1 or n &amp;gt; 200:&lt;br /&gt;
        print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        exit()&lt;br /&gt;
    vector = list(map(int, input().split()))&lt;br /&gt;
    for x in vector:&lt;br /&gt;
        if x &amp;gt;= 1000:&lt;br /&gt;
            print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
            exit()&lt;br /&gt;
    if n != len(vector):&lt;br /&gt;
        print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        exit()&lt;br /&gt;
    nr_nule = 0&lt;br /&gt;
    for element in vector:&lt;br /&gt;
        if element == 0:&lt;br /&gt;
            nr_nule += 1&lt;br /&gt;
    if nr_nule == 0:&lt;br /&gt;
        print(&amp;quot;Datele nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        exit()&lt;br /&gt;
    print(&amp;quot;Datele sunt introduse corect.&amp;quot;)&lt;br /&gt;
    return vector, n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;#039;__main__&amp;#039;:&lt;br /&gt;
    vector, n = citire_conform_restrictiilor()&lt;br /&gt;
    inlocuire_el_nule_cu_media_el_nenule(vector, n)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
== Explicație rezolvare==&lt;br /&gt;
   Acest cod conține o funcție inlocuire_el_nule_cu_media_el_nenule care primește ca argumente un vector și dimensiunea sa și îndeplinește următoarele acțiuni:&amp;lt;br&amp;gt;-&amp;gt; calculează suma și numărul de elemente nenule din vector, folosind o buclă for și o structură condițională if&amp;lt;br&amp;gt;-&amp;gt; calculează media aritmetică a elementelor nenule din vector&amp;lt;br&amp;gt;-&amp;gt; înlocuiește toate elementele nule din vector cu media aritmetică a elementelor nenule din vector&amp;lt;br&amp;gt;-&amp;gt; afișează vectorul inlocuit&amp;lt;br&amp;gt;   De asemenea, codul conține și o funcție citire_conform_restrictiilor care primește ca input de la utilizator o dimensiune n și un vector de n elemente și verifică dacă acestea îndeplinesc anumite restricții, precum:&amp;lt;br&amp;gt;-&amp;gt; dimensiunea vectorului n trebuie să fie între 1 și 200&amp;lt;br&amp;gt;-&amp;gt; fiecare element al vectorului trebuie să fie mai mic decât 1000&amp;lt;br&amp;gt;-&amp;gt; dimensiunea vectorului n trebuie să fie egală cu numărul de elemente introduse de la tastatură&amp;lt;br&amp;gt;-&amp;gt; vectorul trebuie să conțină cel puțin un element nul.&amp;lt;br&amp;gt;   Dacă restricțiile nu sunt respectate, programul afișează un mesaj de eroare și se termină prin apelarea funcției exit(). În caz contrar, programul afișează un mesaj de confirmare și returnează vectorul și dimensiunea sa către apelantul funcției.&amp;lt;br&amp;gt;   În funcția principală __main__, se apelează funcția citire_conform_restrictiilor pentru a obține vectorul și dimensiunea sa și apoi se apelează funcția inlocuire_el_nule_cu_media_el_nenule pentru a afișa vectorul rezultat.&lt;/div&gt;</summary>
		<author><name>Csatari Mălina</name></author>
	</entry>
</feed>