<?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=0383_-_inlocuireK</id>
	<title>0383 - inlocuireK - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=0383_-_inlocuireK"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;action=history"/>
	<updated>2026-05-01T10:59:47Z</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=0383_-_inlocuireK&amp;diff=4510&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=0383_-_inlocuireK&amp;diff=4510&amp;oldid=prev"/>
		<updated>2023-04-26T11:34:40Z</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 11:34, 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-l26&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&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;: 101 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;: 101 2&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&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=0383_-_inlocuireK&amp;diff=4509&amp;oldid=prev</id>
		<title>Csatari Mălina at 11:34, 26 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=4509&amp;oldid=prev"/>
		<updated>2023-04-26T11:34:22Z</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 11:34, 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-l35&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&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;def inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k):&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;def inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k):&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;     for i in range(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;     for i in range(n):&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;         &lt;/del&gt;multiplu_k_inferior = vector[i] // k * k&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;        &lt;/ins&gt;multiplu_k_inferior = vector[i] // k * k&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;         multiplu_k_superior &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;= &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a &lt;/del&gt;+ k&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;         multiplu_k_superior = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;multiplu_k_inferior &lt;/ins&gt;+ k&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;         if abs(vector[i] - &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;multiplu_k_inferior) &amp;lt;= abs(multiplu_k_superior - vector[i]):&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;         if abs(vector[i] - multiplu_k_inferior) &amp;lt;= abs(multiplu_k_superior - vector[i]):&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[i] = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;multiplu_k_inferior&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;             vector[i] = multiplu_k_inferior&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;         else:&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;         else:&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[i] = multiplu_k_superior  &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;             vector[i] = multiplu_k_superior&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 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 i in range(n-1, -1, -1):&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 i in range(n-1, -1, -1):&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;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;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;):&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;def citire_conform_restrictiilor(k, n, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vector&lt;/ins&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; 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;    &lt;/del&gt;k, n &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= map(int&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;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;     if n &amp;lt; 1 or n &amp;gt; 200 or k &amp;lt; 1 or k &amp;gt; 100:&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 or k &amp;lt; 1 or k &amp;gt; 100:&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;lt; 1 or x &amp;gt; 1000000:&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;lt; 1 or x &amp;gt; 1000000:&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-l60&quot;&gt;Line 60:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&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 k, n, vector&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;     k, n, vector = 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;     k, n &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= 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;vector = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;list(map(int, 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;k, n, vector&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;     inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k)&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;     inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k)&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-l81&quot;&gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 80:&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;    Funcția &#039;&#039;&#039;citire_conform_restrictiilor&#039;&#039;&#039; verifică dacă datele de intrare respectă restricțiile impuse în enunțul problemei și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;returnează valorile &lt;/del&gt;k, n &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;și vectorul de numere în cazul în care sunt valide&lt;/del&gt;. &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;În caz contrar, &lt;/del&gt;afișează &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;un mesaj de eroare &lt;/del&gt;și oprește programul prin apelul funcției exit().&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt; &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 conține două funcții, funcția inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k) și funcția citire_conform_restrictiilor(k, n, vector), care sunt apelate în secțiunea &#039;&#039;&#039;if __name__ == &#039;__main__&#039;:&#039;&#039;&#039; (linia 30) după citirea numerelor k și n, respectiv cele n numere pe care le punem în vectorul &quot;vector&quot; (liniile 31, 32).&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;  &lt;/del&gt;Funcția &#039;&#039;&#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&#039;&#039;&#039; primește vectorul și numărul de elemente n din vector, precum și numărul natural k și efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt; pentru fiecare element din vector, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este a sau b, unde b este multiplul lui k imediat mai mare decât a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului, după înlocuire, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;în ordine inversă.&amp;lt;br&amp;gt; &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;    Funcția &#039;&#039;&#039;citire_conform_restrictiilor&#039;&#039;&#039; verifică dacă datele de intrare respectă restricțiile impuse în enunțul problemei &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(n este cuprins între 1 &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;200, &lt;/ins&gt;k &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;este cuprins între 1 și 200, elementele vectorului sunt cuprinse între 1 și 1000000&lt;/ins&gt;, n &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;este lungimea vectorului &quot;vector)&lt;/ins&gt;. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Dacă datele respectă nu respectă oricare dintre restricții se &lt;/ins&gt;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 oprește programul prin apelul funcției exit()&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, iar dacă datele corespund restricțiilor se afișează &quot;Datele sunt introduse corect.&quot; și se poate continua programul&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;  La final, programul citește datele de intrare, apelează funcția &#039;&#039;&#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&#039;&#039;&#039; și afișează vectorul obținut &lt;/del&gt;în ordine inversă.&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;   &lt;/ins&gt;Funcția &#039;&#039;&#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&#039;&#039;&#039; primește &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ca parametrii &lt;/ins&gt;vectorul &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;vector&quot; &lt;/ins&gt;și numărul de elemente n din vector, precum și numărul natural k și efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt; pentru fiecare element din vector, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este a sau b, unde b este multiplul lui k imediat mai mare decât a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului, după înlocuire, în ordine inversă.&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=0383_-_inlocuireK&amp;diff=2025&amp;oldid=prev</id>
		<title>Nagy Lenard at 14:33, 31 March 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2025&amp;oldid=prev"/>
		<updated>2023-03-31T14:33:53Z</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:33, 31 March 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-l35&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&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;def inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k):&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;def inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k):&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;     for i in range(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;     for i in range(n):&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;        a &lt;/del&gt;= vector[i] // k * k&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;         multiplu_k_inferior &lt;/ins&gt;= vector[i] // k * k&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;b &lt;/del&gt;= a + k&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;multiplu_k_superior  &lt;/ins&gt;= a + k&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;         if abs(vector[i] - &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a&lt;/del&gt;) &amp;lt;= abs(&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;b &lt;/del&gt;- vector[i]):&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;         if abs(vector[i] - &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; multiplu_k_inferior&lt;/ins&gt;) &amp;lt;= abs(&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;multiplu_k_superior &lt;/ins&gt;- vector[i]):&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[i] = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a&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;             vector[i] = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; multiplu_k_inferior&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;         else:&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;         else:&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[i] = &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;b&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;             vector[i] = &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;multiplu_k_superior &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;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;     for i in range(n-1, -1, -1):&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 i in range(n-1, -1, -1):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nagy Lenard</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2016&amp;oldid=prev</id>
		<title>Csatari Mălina: /* Explicație rezolvare */</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2016&amp;oldid=prev"/>
		<updated>2023-03-31T13:01:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Explicație rezolvare&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 13:01, 31 March 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-l82&quot;&gt;Line 82:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 82:&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;&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;    Funcția &amp;#039;&amp;#039;&amp;#039;citire_conform_restrictiilor&amp;#039;&amp;#039;&amp;#039; verifică dacă datele de intrare respectă restricțiile impuse în enunțul problemei și returnează valorile k, n și vectorul de numere în cazul în care sunt valide. În caz contrar, afișează un mesaj de eroare și oprește programul prin apelul funcției exit().&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;    Funcția &amp;#039;&amp;#039;&amp;#039;citire_conform_restrictiilor&amp;#039;&amp;#039;&amp;#039; verifică dacă datele de intrare respectă restricțiile impuse în enunțul problemei și returnează valorile k, n și vectorul de numere în cazul în care sunt valide. În caz contrar, afișează un mesaj de eroare și oprește programul prin apelul funcției exit().&amp;lt;br&amp;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;   Funcția &#039;&#039;&#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&#039;&#039;&#039; primește vectorul și numărul de elemente n din vector, precum și numărul natural k și efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt;pentru fiecare element din vector, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este a sau b, unde b este multiplul lui k imediat mai mare decât a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului, după înlocuire, în ordine inversă.&amp;lt;br&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;   Funcția &#039;&#039;&#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&#039;&#039;&#039; primește vectorul și numărul de elemente n din vector, precum și numărul natural k și efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt; pentru fiecare element din vector, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este a sau b, unde b este multiplul lui k imediat mai mare decât a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului, după înlocuire, în ordine inversă.&amp;lt;br&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;   La final, programul citește datele de intrare, apelează funcția &amp;#039;&amp;#039;&amp;#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&amp;#039;&amp;#039;&amp;#039; și afișează vectorul obținut în ordine inversă.&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;   La final, programul citește datele de intrare, apelează funcția &amp;#039;&amp;#039;&amp;#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&amp;#039;&amp;#039;&amp;#039; și afișează vectorul obținut în ordine inversă.&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=0383_-_inlocuireK&amp;diff=2015&amp;oldid=prev</id>
		<title>Csatari Mălina: Anularea modificării 2014 făcute de Csatari Mălina (Discuție)</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2015&amp;oldid=prev"/>
		<updated>2023-03-31T13:00:35Z</updated>

		<summary type="html">&lt;p&gt;Anularea modificării 2014 făcute de &lt;a href=&quot;/wiki/Special:Contributions/Csatari_M%C4%83lina&quot; title=&quot;Special:Contributions/Csatari Mălina&quot;&gt;Csatari Mălina&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Csatari_M%C4%83lina&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Csatari Mălina (page does not exist)&quot;&gt;Discuție&lt;/a&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 13:00, 31 March 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-l81&quot;&gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 81:&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 definește trei funcții și un bloc &lt;/del&gt;&#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;if __name__ == &lt;/del&gt;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__main__&lt;/del&gt;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&lt;/del&gt;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; care apelează aceste funcții &lt;/del&gt;în &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcție de anumite condiții. Iată un rezumat al fiecărei funcții:&amp;lt;br&amp;gt;1. &#039;&#039;&#039;citire_cu_restrictii_m_n()&#039;&#039;&#039;: Această funcție cere utilizatorului să introducă două numere întregi separate prin spațiu &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;verifică dacă acestea corespund anumitor restricții. Dacă &lt;/del&gt;valorile &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;introduse sunt în afara acestor restricții&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va afișa un mesaj &lt;/del&gt;de &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;eroare și va încheia programul prin apelarea funcției exit()&lt;/del&gt;. În caz contrar, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va returna cele două valori ca o tuplă.&amp;lt;br&amp;gt;2. &#039;&#039;&#039;verificare_vectori_conform_restrictiilor(vector)&#039;&#039;&#039;: Această funcție primește un vector ca parametru și verifică dacă valorile acestuia corespund unor restricții impuse. Dacă valorile sunt în afara acestor restricții, funcția va afișa &lt;/del&gt;un mesaj de eroare și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;va încheia &lt;/del&gt;programul prin &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apelarea &lt;/del&gt;funcției exit().&amp;lt;br&amp;gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3. &lt;/del&gt;&#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrare_max_cnt(m, n)&lt;/del&gt;&#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: Această funcție &lt;/del&gt;primește &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;doi parametri, m &lt;/del&gt;și n, și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrează datele introduse de utilizator. Funcția va citi n vectori de lungime m de la tastatură &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;va găsi valoarea maximă &lt;/del&gt;din &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;fiecare &lt;/del&gt;vector&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Dacă valoarea maximă &lt;/del&gt;a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;unui vector &lt;/del&gt;este mai mare decât &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;valoarea maximă găsită până atunci&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va actualiza această valoare maximă și va reseta contorul. Dacă valoarea maximă este aceeași cu valoarea maximă găsită anterior&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va incrementa contorul&lt;/del&gt;. La final, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va afișa un mesaj &lt;/del&gt;de &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;confirmare și valorile maxime și contorul calculat.&amp;lt;br&amp;gt;    Funcția &#039;&#039;&#039;citire_cu_restrictii_m_n()&#039;&#039;&#039; este apelată în blocul &#039;if __name__ == &#039;__main__&#039;:&#039; pentru a citi valorile m și n și pentru a verifica dacă acestea corespund restricțiilor. Dacă valorile sunt corecte&lt;/del&gt;, funcția &#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrare_max_cnt()&lt;/del&gt;&#039;&#039;&#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;este apelată pentru a prelucra datele introduse de utilizator&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;Funcția &lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;citire_conform_restrictiilor&lt;/ins&gt;&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;verifică dacă datele de intrare respectă restricțiile impuse &lt;/ins&gt;în &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;enunțul problemei &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;returnează &lt;/ins&gt;valorile &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;k&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n și vectorul &lt;/ins&gt;de &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numere în cazul în care sunt valide&lt;/ins&gt;. În caz contrar, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;afișează &lt;/ins&gt;un mesaj de eroare și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;oprește &lt;/ins&gt;programul prin &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apelul &lt;/ins&gt;funcției exit().&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;  Funcția &lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;inloc_elem_cu_multiplu_k_cel_mai_apropiat&lt;/ins&gt;&#039;&#039;&#039; primește &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vectorul &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numărul de elemente &lt;/ins&gt;n &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;din vector&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;precum &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numărul natural k &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt;pentru fiecare element &lt;/ins&gt;din vector&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sau b, unde b &lt;/ins&gt;este &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;multiplul lui k imediat &lt;/ins&gt;mai mare decât &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;după înlocuire&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;în ordine inversă&lt;/ins&gt;.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;gt; &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;La final, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;programul citește datele &lt;/ins&gt;de &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;intrare&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apelează &lt;/ins&gt;funcția &#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;inloc_elem_cu_multiplu_k_cel_mai_apropiat&lt;/ins&gt;&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;și afișează vectorul obținut în ordine inversă&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=0383_-_inlocuireK&amp;diff=2014&amp;oldid=prev</id>
		<title>Csatari Mălina at 12:59, 31 March 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2014&amp;oldid=prev"/>
		<updated>2023-03-31T12:59:53Z</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 12:59, 31 March 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-l81&quot;&gt;Line 81:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 81:&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;Funcția &lt;/del&gt;&#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;citire_conform_restrictiilor&lt;/del&gt;&#039;&#039;&#039; verifică dacă &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;datele de intrare respectă restricțiile impuse &lt;/del&gt;în &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;enunțul problemei și returnează valorile k&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;n &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vectorul de numere în cazul în care sunt valide&lt;/del&gt;. În caz contrar, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;afișează &lt;/del&gt;un mesaj de eroare și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;oprește &lt;/del&gt;programul prin &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apelul &lt;/del&gt;funcției exit().&amp;lt;br&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;    &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Acest cod definește trei funcții și un bloc &#039;&#039;&#039;if __name__ == &#039;__main__&#039;:&#039;&#039;&#039; care apelează aceste funcții în funcție de anumite condiții. Iată un rezumat al fiecărei funcții:&amp;lt;br&amp;gt;1. &lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;citire_cu_restrictii_m_n()&lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: Această funcție cere utilizatorului să introducă două numere întregi separate prin spațiu și &lt;/ins&gt;verifică dacă &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;acestea corespund anumitor restricții. Dacă valorile introduse sunt &lt;/ins&gt;în &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;afara acestor restricții&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va afișa un mesaj de eroare &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;va încheia programul prin apelarea funcției exit()&lt;/ins&gt;. În caz contrar, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va returna cele două valori ca o tuplă.&amp;lt;br&amp;gt;2. &#039;&#039;&#039;verificare_vectori_conform_restrictiilor(vector)&#039;&#039;&#039;: Această funcție primește un vector ca parametru și verifică dacă valorile acestuia corespund unor restricții impuse. Dacă valorile sunt în afara acestor restricții, funcția va afișa &lt;/ins&gt;un mesaj de eroare și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;va încheia &lt;/ins&gt;programul prin &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;apelarea &lt;/ins&gt;funcției exit().&amp;lt;br&amp;gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3. &lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrare_max_cnt(m, n)&lt;/ins&gt;&#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;: Această funcție &lt;/ins&gt;primește &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;doi parametri, m &lt;/ins&gt;și n, și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrează datele introduse de utilizator. Funcția va citi n vectori de lungime m de la tastatură &lt;/ins&gt;și &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;va găsi valoarea maximă din &lt;/ins&gt;fiecare vector&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Dacă valoarea maximă &lt;/ins&gt;a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;unui vector &lt;/ins&gt;este mai mare decât &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;valoarea maximă găsită până atunci, funcția va actualiza această valoare maximă și va reseta contorul. Dacă valoarea maximă este aceeași &lt;/ins&gt;cu &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;valoarea maximă găsită anterior&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va incrementa contorul. La final&lt;/ins&gt;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;funcția va afișa un mesaj de confirmare și valorile maxime și contorul calculat&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_cu_restrictii_m_n()&#039;&#039;&#039; este apelată în blocul &#039;if __name__ == &#039;__main__&#039;:&#039; pentru a citi valorile m și n și pentru a verifica dacă acestea corespund restricțiilor. Dacă valorile sunt corecte&lt;/ins&gt;, funcția &#039;&#039;&#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;prelucrare_max_cnt()&lt;/ins&gt;&#039;&#039;&#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;este apelată pentru a prelucra datele introduse de utilizator&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;  Funcția &lt;/del&gt;&#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;inloc_elem_cu_multiplu_k_cel_mai_apropiat&lt;/del&gt;&#039;&#039;&#039; primește &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;vectorul &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numărul de elemente &lt;/del&gt;n &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;din vector&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;precum &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;numărul natural k &lt;/del&gt;și &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt;pentru &lt;/del&gt;fiecare &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;element din &lt;/del&gt;vector&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este &lt;/del&gt;a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;sau b, unde b &lt;/del&gt;este &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;multiplul lui k imediat &lt;/del&gt;mai mare decât &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector &lt;/del&gt;cu &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;după înlocuire&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;în ordine inversă&lt;/del&gt;.&amp;lt;br&amp;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; 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;  La final&lt;/del&gt;, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;programul citește datele de intrare, apelează &lt;/del&gt;funcția &#039;&#039;&#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;inloc_elem_cu_multiplu_k_cel_mai_apropiat&lt;/del&gt;&#039;&#039;&#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;și afișează vectorul obținut în ordine inversă&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;/table&gt;</summary>
		<author><name>Csatari Mălina</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2011&amp;oldid=prev</id>
		<title>Csatari Mălina: Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/383/inlocuirek 0383- inlocuireK] ---- == Cerinţa == Se dă un număr natural nenul &#039;&#039;&#039;k&#039;&#039;&#039; și vector cu &#039;&#039;&#039;n&#039;&#039;&#039; numere naturale. Să se înlocuiască fiecare element cu multiplul lui &#039;&#039;&#039;k&#039;&#039;&#039; cel mai apropiat de el și să se afișeze elementele astfel obținute în ordine inversă. == Date de intrare == Programul citește de la tastatură numerele &#039;&#039;&#039;k&#039;&#039;&#039; și &#039;&#039;&#039;n&#039;&#039;&#039;, iar apoi &#039;&#039;&#039;n&#039;&#039;&#039; numere naturale, separate prin spaţii, reprezentâ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0383_-_inlocuireK&amp;diff=2011&amp;oldid=prev"/>
		<updated>2023-03-31T10:50:16Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: Sursa: [https://www.pbinfo.ro/probleme/383/inlocuirek 0383- inlocuireK] ---- == Cerinţa == Se dă un număr natural nenul &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; și vector cu &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale. Să se înlocuiască fiecare element cu multiplul lui &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; cel mai apropiat de el și să se afișeze elementele astfel obținute în ordine inversă. == Date de intrare == Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; și &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â...&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/383/inlocuirek 0383- inlocuireK]&lt;br /&gt;
----&lt;br /&gt;
== Cerinţa ==&lt;br /&gt;
Se dă un număr natural nenul &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; și vector cu &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale. Să se înlocuiască fiecare element cu multiplul lui &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; cel mai apropiat de el și să se afișeze elementele astfel obținute în ordine inversă.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; și &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 va afișa elementele vectorului, după înlocuire, în ordine inversă, separate prin exact 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;
* &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;k&amp;#039;&amp;#039;&amp;#039; &amp;amp;les; &amp;#039;&amp;#039;&amp;#039;100&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* elementele vectorului vor fi cuprinse între &amp;#039;&amp;#039;&amp;#039;1&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;1.000.000&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* dacă pentru un element al vectorului există mai multi cei mai apropiați multipli ai lui k, elementul va fi înlocui cu cel mai mic dintre aceștia&lt;br /&gt;
&lt;br /&gt;
== Exemple ==&lt;br /&gt;
===Exemplul 1===&lt;br /&gt;
; Intrare&lt;br /&gt;
: 5 4&lt;br /&gt;
: 17 14 24 25&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele sunt introduse corect.&lt;br /&gt;
: 25 25 15 15&lt;br /&gt;
===Exemplul 2===&lt;br /&gt;
; Intrare&lt;br /&gt;
: 101 2&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;
# 0383&lt;br /&gt;
&lt;br /&gt;
def inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k):&lt;br /&gt;
    for i in range(n):&lt;br /&gt;
        a = vector[i] // k * k&lt;br /&gt;
        b = a + k&lt;br /&gt;
        if abs(vector[i] - a) &amp;lt;= abs(b - vector[i]):&lt;br /&gt;
            vector[i] = a&lt;br /&gt;
        else:&lt;br /&gt;
            vector[i] = b&lt;br /&gt;
&lt;br /&gt;
    for i in range(n-1, -1, -1):&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;
    k, n = map(int, input().split())&lt;br /&gt;
    if n &amp;lt; 1 or n &amp;gt; 200 or k &amp;lt; 1 or k &amp;gt; 100:&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;lt; 1 or x &amp;gt; 1000000:&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;
    print(&amp;quot;Datele sunt introduse corect.&amp;quot;)&lt;br /&gt;
    return k, n, vector&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;#039;__main__&amp;#039;:&lt;br /&gt;
    k, n, vector = citire_conform_restrictiilor()&lt;br /&gt;
    inloc_elem_cu_multiplu_k_cel_mai_apropiat(vector, n, k)&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;
   Funcția &amp;#039;&amp;#039;&amp;#039;citire_conform_restrictiilor&amp;#039;&amp;#039;&amp;#039; verifică dacă datele de intrare respectă restricțiile impuse în enunțul problemei și returnează valorile k, n și vectorul de numere în cazul în care sunt valide. În caz contrar, afișează un mesaj de eroare și oprește programul prin apelul funcției exit().&amp;lt;br&amp;gt; &lt;br /&gt;
  Funcția &amp;#039;&amp;#039;&amp;#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&amp;#039;&amp;#039;&amp;#039; primește vectorul și numărul de elemente n din vector, precum și numărul natural k și efectuează următoarele operații:&amp;lt;br&amp;gt;-&amp;gt;pentru fiecare element din vector, găsește cel mai apropiat multiplu al lui k, prin împărțirea elementului la k și înmulțirea rezultatului cu k;&amp;lt;br&amp;gt;-&amp;gt; determină dacă cel mai apropiat multiplu este a sau b, unde b este multiplul lui k imediat mai mare decât a;&amp;lt;br&amp;gt;-&amp;gt; înlocuiește elementul din vector cu cel mai apropiat multiplu găsit;&amp;lt;br&amp;gt;-&amp;gt; afișează elementele vectorului, după înlocuire, în ordine inversă.&amp;lt;br&amp;gt; &lt;br /&gt;
  La final, programul citește datele de intrare, apelează funcția &amp;#039;&amp;#039;&amp;#039;inloc_elem_cu_multiplu_k_cel_mai_apropiat&amp;#039;&amp;#039;&amp;#039; și afișează vectorul obținut în ordine inversă.&lt;/div&gt;</summary>
		<author><name>Csatari Mălina</name></author>
	</entry>
</feed>