#4719
Dat un număr natural n să se determine cea mai mare cifră pară și cea mai mică cifră impară a sa.
Concurs selectie clasa a 9-a Centru de Excelenta in Informatica - 2024 - Vaslui
| Problema | vesel4 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64730201 | Utilizator | |
| Fișier | vesel4.cpp | Dimensiune | 540 B |
| Data încărcării | 26 Mai 2026, 14:20 | Scor/rezultat | Eroare de compilare |
vesel4.cpp: In function ‘int main()’: vesel4.cpp:11:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 11 | if(n%10%2==1 && n%10<=cmin) | ^~ vesel4.cpp:13:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 13 | ok=1; | ^~ vesel4.cpp:14:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 14 | if(n%10%2==0 && n%10>=cmax) | ^~ vesel4.cpp:16:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 16 | k=1; | ^ vesel4.cpp:7:25: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable] 7 | int n,cmin=9,cmax=0,ok=0,k=0; | ^~ vesel4.cpp:7:30: warning: variable ‘k’ set but not used [-Wunused-but-set-variable] 7 | int n,cmin=9,cmax=0,ok=0,k=0; | ^ vesel4.cpp: At global scope: vesel4.cpp:21:5: error: expected unqualified-id before ‘if’ 21 | if(ok && k) | ^~ vesel4.cpp:23:5: error: expected unqualified-id before ‘if’ 23 | if(ok && k==0) | ^~ vesel4.cpp:25:5: error: expected unqualified-id before ‘if’ 25 | if(ok==0 && k) | ^~ vesel4.cpp:27:5: error: expected unqualified-id before ‘if’ 27 | if(ok==0 && k==0) | ^~ vesel4.cpp:29:5: error: expected unqualified-id before ‘return’ 29 | return 0; | ^~~~~~ vesel4.cpp:30:1: error: expected declaration before ‘}’ token 30 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema vesel4 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ă.