#1544
Muzical
C++
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:
do1
cu numărul 0
re
cu numărul 1
mi
cu numărul 2
fa
cu numărul 3
sol
cu numărul 4
la
cu numărul 5
si
cu numărul 6
do2
cu numărul 7
El creează un cântec, ia notele muzicale și le codează ca mai sus, le adună, iar apoi împarte suma la 8
și restul rămas este nota maximă.
Ajutați-l pe Gigel sa afle nota maximă!
Problema | Muzical | Operații I/O |
muzical.in /muzical.out
|
---|---|---|---|
Limita timp | 0.25 secunde | Limita memorie |
Total: 3 MB
/
Stivă 3 MB
|
Id soluție | #21193105 | Utilizator | |
Fișier | muzical.cpp | Dimensiune | 1.63 KB |
Data încărcării | 22 Februarie 2020, 23:13 | Scor / rezultat | 100 puncte |
muzical.cpp: In function 'int NoteToNumber(char*)': muzical.cpp:26:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "do1")) ^ muzical.cpp:28:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "re")) ^ muzical.cpp:30:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "mi")) ^ muzical.cpp:32:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "fa")) ^ muzical.cpp:34:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "sol")) ^ muzical.cpp:36:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "la")) ^ muzical.cpp:38:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "si")) ^ muzical.cpp:40:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] if (Compare(sir, "do2")) ^ muzical.cpp: In function 'char* NumberToNote(int)': muzical.cpp:47:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "do1"; ^ muzical.cpp:49:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "re"; ^ muzical.cpp:51:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "mi"; ^ muzical.cpp:53:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "fa"; ^ muzical.cpp:55:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "sol"; ^ muzical.cpp:57:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "la"; ^ muzical.cpp:59:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "si"; ^ muzical.cpp:61:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] return "do2"; ^ muzical.cpp: In function 'int NoteToNumber(char*)': muzical.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ muzical.cpp: In function 'char* NumberToNote(int)': muzical.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ muzical.cpp: In function 'int main()': muzical.cpp:68:24: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(fin,"%d",&n); /// pot pune mai multe variabile %d %d etc. ^ muzical.cpp:71:31: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(fin,"%s ", sir); ///citim un sir de caractere/cifra (%s %d) pana la spatiu ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 10 | 10 | Exemplu | |
2 | 0 secunde | OK. | 15 | 15 | ||
3 | 0 secunde | OK. | 20 | 20 | ||
4 | 0 secunde | OK. | 25 | 25 | ||
5 | 0.008 secunde | OK. | 30 | 30 | ||
Punctaj total | 100 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Muzical face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.