<?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=4296_-_Sum_Div</id>
	<title>4296 - Sum Div - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=4296_-_Sum_Div"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;action=history"/>
	<updated>2026-06-17T03:45:21Z</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=4296_-_Sum_Div&amp;diff=5230&amp;oldid=prev</id>
		<title>Robert Manc at 15:26, 28 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;diff=5230&amp;oldid=prev"/>
		<updated>2023-04-28T15:26:47Z</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 15:26, 28 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-l69&quot;&gt;Line 69:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 69:&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;&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 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 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;== Explicație ==&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;Codul calculează suma numerelor dintr-o listă dată, care au cel puțin p divizori. Datele de intrare sunt primite de la utilizator și sunt validate prin funcția validare_date(). Funcția nrdiv() calculează numărul de divizori ai unui număr dat, iar funcția suma_p_divizori() calculează suma numerelor din listă care au cel puțin p divizori. Dacă datele de intrare corespund restricțiilor impuse, se afișează suma calculată, altfel se afișează un mesaj corespunzător.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Robert Manc</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;diff=3410&amp;oldid=prev</id>
		<title>Robert Manc at 10:29, 11 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;diff=3410&amp;oldid=prev"/>
		<updated>2023-04-11T10:29:06Z</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:29, 11 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-l15&quot;&gt;Line 15:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 15:&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;: 7 4 10 17 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;: 7 4 10 17 1&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; 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;: Datele &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;introduse &lt;/del&gt;corespund restricțiilor impuse.&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;: Datele &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;de intrare &lt;/ins&gt;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;: 14&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;: 14&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 ==  &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 ==  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Robert Manc</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;diff=1437&amp;oldid=prev</id>
		<title>Robert Manc: Pagină nouă: == Cerinţa == Se dă un șir de &#039;&#039;&#039;n&#039;&#039;&#039; numere naturale nenule și de asemenea un număr natural &#039;&#039;&#039;p&#039;&#039;&#039;. Să se calculeze suma numerelor din șir care au cel puțin &#039;&#039;&#039;p&#039;&#039;&#039; divizori. == Date de intrare == Programul citește de la tastatură numerele &#039;&#039;&#039;nr&#039;&#039;&#039; și &#039;&#039;&#039;p&#039;&#039;&#039;, iar apoi șirul de &#039;&#039;&#039;n&#039;&#039;&#039; numere naturale, separate prin spații. == Date de ieşire == Programul va afișa pe ecran numărul &#039;&#039;&#039;suma&#039;&#039;&#039;, reprezentând suma numerelor din șir care au cel puțin &#039;&#039;&#039;p&#039;&#039;&#039; di...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=4296_-_Sum_Div&amp;diff=1437&amp;oldid=prev"/>
		<updated>2023-03-22T14:14:50Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerinţa == Se dă un șir de &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale nenule și de asemenea un număr natural &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039;. Să se calculeze suma numerelor din șir care au cel puțin &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039; divizori. == Date de intrare == Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;nr&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039;, iar apoi șirul de &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale, separate prin spații. == Date de ieşire == Programul va afișa pe ecran numărul &amp;#039;&amp;#039;&amp;#039;suma&amp;#039;&amp;#039;&amp;#039;, reprezentând suma numerelor din șir care au cel puțin &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039; di...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerinţa ==&lt;br /&gt;
Se dă un șir de &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale nenule și de asemenea un număr natural &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039;. Să se calculeze suma numerelor din șir care au cel puțin &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039; divizori.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;nr&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039;, iar apoi șirul de &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere naturale, separate prin spații.&lt;br /&gt;
== Date de ieşire ==&lt;br /&gt;
Programul va afișa pe ecran numărul &amp;#039;&amp;#039;&amp;#039;suma&amp;#039;&amp;#039;&amp;#039;, reprezentând suma numerelor din șir care au cel puțin &amp;#039;&amp;#039;&amp;#039;p&amp;#039;&amp;#039;&amp;#039; divizori.&lt;br /&gt;
== Restricții și precizări ==&lt;br /&gt;
* nr &amp;amp;isin; &amp;amp;Nu;&lt;br /&gt;
* 1 &amp;amp;les; nr &amp;amp;les; 100.000&lt;br /&gt;
* 1 &amp;amp;les; p &amp;amp;les; 100.000&lt;br /&gt;
* cele &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; numere din șir vor fi numere naturale nenule mai mici decât &amp;#039;&amp;#039;&amp;#039;1.000.000&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
== Exemplu1 ==&lt;br /&gt;
; Intrare&lt;br /&gt;
: 5 3&lt;br /&gt;
: 7 4 10 17 1&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele introduse corespund restricțiilor impuse.&lt;br /&gt;
: 14&lt;br /&gt;
== Explicație == &lt;br /&gt;
Numerele din șir care au cel puțin &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039; divizori sunt &amp;#039;&amp;#039;&amp;#039;4&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;10&amp;#039;&amp;#039;&amp;#039;, iar suma lor este &amp;#039;&amp;#039;&amp;#039;14&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
== Exemplu2 ==&lt;br /&gt;
; Intrare&lt;br /&gt;
: 5 100&lt;br /&gt;
: 5 12 24 3 72&lt;br /&gt;
; Ieșire&lt;br /&gt;
: Datele introduse corespund restricțiilor impuse.&lt;br /&gt;
: 0&lt;br /&gt;
== Explicație == &lt;br /&gt;
Niciun număr nu are cel puțin &amp;#039;&amp;#039;&amp;#039;100&amp;#039;&amp;#039;&amp;#039; de divizori, deci suma este &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
import math&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def validare_date(nr, p, n):&lt;br /&gt;
    flag = False&lt;br /&gt;
    if 0 &amp;lt;= int(nr) &amp;lt;= 1_000 and 1 &amp;lt;= int(p) &amp;lt;= 1_0000:&lt;br /&gt;
        flag = all(isinstance(x, int) and 1 &amp;lt;= x &amp;lt;= 1_000_000 for x in n)&lt;br /&gt;
    return flag&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def nrdiv(n):&lt;br /&gt;
    cnt = 0&lt;br /&gt;
    for i in range(1, int(math.sqrt(n))+1):&lt;br /&gt;
        if n % i == 0:&lt;br /&gt;
            cnt += 2&lt;br /&gt;
        if i * i == n:&lt;br /&gt;
            cnt -= 1&lt;br /&gt;
    return cnt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def suma_p_divizori(n, p):&lt;br /&gt;
    suma = 0&lt;br /&gt;
    for i in n:&lt;br /&gt;
        if nrdiv(i) &amp;gt;= p:&lt;br /&gt;
            suma += i&lt;br /&gt;
    return suma&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;#039;__main__&amp;#039;:&lt;br /&gt;
    nr, p = map(int, input().split())&lt;br /&gt;
    n = list(map(int, input().split()))&lt;br /&gt;
    if validare_date(nr, p, n):&lt;br /&gt;
        print(&amp;quot;\nDatele de intrare corespund restricțiilor impuse.\n&amp;quot;)&lt;br /&gt;
        suma = suma_p_divizori(n, p)&lt;br /&gt;
        print(suma)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Robert Manc</name></author>
	</entry>
</feed>