<?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=1544_-_Muzical</id>
	<title>1544 - Muzical - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1544_-_Muzical"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1544_-_Muzical&amp;action=history"/>
	<updated>2026-05-01T06:49:38Z</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=1544_-_Muzical&amp;diff=6110&amp;oldid=prev</id>
		<title>Ardelean Alexandru: Pagină nouă: ==Cerința== Gigel în timp ce așteptă să meargă la doctor se joacă cu noul lui telefon. A observat ca atunci când este pe ecranul de start și apasă pe o tastă numerică se aude o notă muzicală.  Dar lui i-a venit ideea să codeze fiecare notă muzicală în acest mod:  * Nota &lt;code&gt;do1&lt;/code&gt; cu numărul &lt;code&gt;0&lt;/code&gt; * Nota &lt;code&gt;re&lt;/code&gt; cu numărul &lt;code&gt;1&lt;/code&gt; * Nota &lt;code&gt;mi&lt;/code&gt; cu numărul &lt;code&gt;2&lt;/code&gt; * Nota &lt;code&gt;fa&lt;/code&gt; cu numărul &lt;code&gt;3&lt;/cod...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1544_-_Muzical&amp;diff=6110&amp;oldid=prev"/>
		<updated>2023-05-07T10:35:52Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: ==Cerința== Gigel în timp ce așteptă să meargă la doctor se joacă cu noul lui telefon. A observat ca atunci când este pe ecranul de start și apasă pe o tastă numerică se aude o notă muzicală.  Dar lui i-a venit ideea să codeze fiecare notă muzicală în acest mod:  * Nota &amp;lt;code&amp;gt;do1&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; * Nota &amp;lt;code&amp;gt;re&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; * Nota &amp;lt;code&amp;gt;mi&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt; * Nota &amp;lt;code&amp;gt;fa&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;3&amp;lt;/cod...&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;
Gigel în timp ce așteptă să meargă la doctor se joacă cu noul lui telefon. A observat ca atunci când este pe ecranul de start și apasă pe o tastă numerică se aude o notă muzicală.&lt;br /&gt;
&lt;br /&gt;
Dar lui i-a venit ideea să codeze fiecare notă muzicală în acest mod:&lt;br /&gt;
&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;do1&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;re&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;mi&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;fa&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;sol&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;la&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;si&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;&lt;br /&gt;
* Nota &amp;lt;code&amp;gt;do2&amp;lt;/code&amp;gt; cu numărul &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El creează un cântec, ia notele muzicale și le codează ca mai sus, le adună, iar apoi împarte suma la &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt; și restul rămas este nota maximă.&lt;br /&gt;
&lt;br /&gt;
Ajutați-l pe Gigel sa afle nota maximă!&lt;br /&gt;
&lt;br /&gt;
==Date de intrare==&lt;br /&gt;
Fișierul de intrare &amp;lt;code&amp;gt;muzical.in&amp;lt;/code&amp;gt; conține pe prima linie numărul &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; și pe a doua linie &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; note muzicale.&lt;br /&gt;
==Date de ieșire==&lt;br /&gt;
Pe ecran se va afișa mesajul: &amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Pe următoarea linie se va afișa nota maximă.&lt;br /&gt;
&lt;br /&gt;
În cazul în care datele introduse de la tastatură nu îndeplinesc cerințele enunțate, pe ecran se va afișa mesajul &amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Restricții și precizări==&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;n ≤ 100.000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Exemplu 1==&lt;br /&gt;
;Intrare&lt;br /&gt;
:8&lt;br /&gt;
:do1 re mi fa sol la si do2&lt;br /&gt;
;Ieșire&lt;br /&gt;
:Datele de intrare corespund restricțiilor impuse.&lt;br /&gt;
:sol&lt;br /&gt;
===Explicație===&lt;br /&gt;
&amp;lt;code&amp;gt;do1&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;re&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mi&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fa&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sol&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;la&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;si&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;do2&amp;lt;/code&amp;gt; se codifică prin &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adunând codificările notelor se obține suma &amp;lt;code&amp;gt;28&amp;lt;/code&amp;gt;, iar restul sumei la împărțirea prin &amp;lt;code&amp;gt;8&amp;lt;/code&amp;gt; este &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;, deci nota maximă este &amp;lt;code&amp;gt;sol&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Exemplu 2==&lt;br /&gt;
;Intrare&lt;br /&gt;
:5000000&lt;br /&gt;
:do1 re mi fa sol la si do2&lt;br /&gt;
;Ieșire&lt;br /&gt;
:Datele de intrare nu corespund restricțiilor impuse.&lt;br /&gt;
==Rezolvare==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
# 1544 - Muzical&lt;br /&gt;
def conditii(n, note_muzicale):&lt;br /&gt;
    return n &amp;lt;= 100_000 and \&lt;br /&gt;
         all(nota in (&amp;quot;do1&amp;quot;, &amp;quot;re&amp;quot;, &amp;quot;mi&amp;quot;, &amp;quot;fa&amp;quot;, &amp;quot;sol&amp;quot;, &amp;quot;la&amp;quot;, &amp;quot;si&amp;quot;, &amp;quot;do2&amp;quot;) for nota in note_muzicale)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def muzical(note_muzicale):&lt;br /&gt;
    # Inițializăm un dicționar cu notele muzicale și codificările lor&lt;br /&gt;
    note_dictionar = {&lt;br /&gt;
        &amp;quot;do1&amp;quot;: 0, &amp;quot;re&amp;quot;: 1, &amp;quot;mi&amp;quot;: 2,&lt;br /&gt;
        &amp;quot;fa&amp;quot;: 3, &amp;quot;sol&amp;quot;: 4, &amp;quot;la&amp;quot;: 5,&lt;br /&gt;
        &amp;quot;si&amp;quot;: 6, &amp;quot;do2&amp;quot;: 7&lt;br /&gt;
    }&lt;br /&gt;
    # Însumăm codificările notelor muzicale&lt;br /&gt;
    suma_note = sum(note_dictionar[nota] for nota in note_muzicale)&lt;br /&gt;
    rest = suma_note % 8&lt;br /&gt;
    &lt;br /&gt;
    # Preluăm din dicționar nota muzicală corespunzătoare restului obținut&lt;br /&gt;
    print(note_muzicale[rest])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    n = int(input())&lt;br /&gt;
    note_muzicale = [nota for nota in input().split()]&lt;br /&gt;
&lt;br /&gt;
    if not conditii(n, note_muzicale):&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
        muzical(note_muzicale)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ardelean Alexandru</name></author>
	</entry>
</feed>