#4867
Două numere naturale se numesc asociate dacă sumele cifrelor lor se împart exact la 2 sau la 3 sau la 5.
Date două numere naturale a și b, să se verifice dacă sunt asociate.
Concurs de selecție clasa a 9-a Centru de Excelență in Informatică 2025 - Vaslui
| Problema | Asociat | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64899799 | Utilizator | |
| Fișier | asociat.cpp | Dimensiune | 412 B |
| Data încărcării | 10 Iunie 2026, 18:16 | Scor/rezultat | 50 puncte |
asociat.cpp: In function ‘int main()’: asociat.cpp:21:62: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] 21 | if(sumcif(a) %2==0 || sumcif(a) %3==0 || sumcif(a) %5==0 && (sumcif (b) %2==0 || sumcif (b)%3==0 || sumcif (b)%5==0)) | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ asociat.cpp:21:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 21 | if(sumcif(a) %2==0 || sumcif(a) %3==0 || sumcif(a) %5==0 && (sumcif (b) %2==0 || sumcif (b)%3==0 || sumcif (b)%5==0)) | ^~ asociat.cpp:23:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 23 | return 0; | ^~~~~~ asociat.cpp: In function ‘int sumcif(int)’: asociat.cpp:10:9: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 10 | s=s+x%10; | ~^~~~~~~ asociat.cpp:6:7: note: ‘s’ was declared here 6 | { int s; | ^ asociat.cpp: In function ‘int main()’: asociat.cpp:6:7: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] asociat.cpp:21:37: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 21 | if(sumcif(a) %2==0 || sumcif(a) %3==0 || sumcif(a) %5==0 && (sumcif (b) %2==0 || sumcif (b)%3==0 || sumcif (b)%5==0)) | ~~~~~~~~~~^~ asociat.cpp:6:7: note: ‘s’ was declared here 6 | { int s; | ^ asociat.cpp:6:7: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] asociat.cpp:21:96: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 21 | if(sumcif(a) %2==0 || sumcif(a) %3==0 || sumcif(a) %5==0 && (sumcif (b) %2==0 || sumcif (b)%3==0 || sumcif (b)%5==0)) | ~~~~~~~~~~^~ asociat.cpp:6:7: note: ‘s’ was declared here 6 | { int s; | ^ In function ‘int sumcif(int)’, inlined from ‘int main()’ at asociat.cpp:21:52: asociat.cpp:10:9: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 10 | s=s+x%10; | ~^~~~~~~ asociat.cpp: In function ‘int main()’: asociat.cpp:6:7: note: ‘s’ was declared here 6 | { int s; | ^ In function ‘int sumcif(int)’, inlined from ‘int main()’ at asociat.cpp:21:112: asociat.cpp:10:9: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 10 | s=s+x%10; | ~^~~~~~~ asociat.cpp: In function ‘int main()’: asociat.cpp:6:7: note: ‘s’ was declared here 6 | { int s; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.003 secunde | OK. | 10 | 10 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 10 | 0 | Exemplu | |
| 3 | 0.001 secunde | OK. | 10 | 10 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 6 | 0.001 secunde | OK. | 20 | 20 | ||
| 7 | 0.001 secunde | OK. | 10 | 10 | ||
| Punctaj total | 50 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Asociat 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ă.