#1148
Se dă un şir cu n elemente, numere naturale. Folosind metoda Divide et Impera să se verifice dacă în şir există elemente impare.
| Problema | ExistaImpareDivImp | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64196351 | Utilizator | |
| Fișier | existaimparedivimp.cpp | Dimensiune | 217 B |
| Data încărcării | 22 Aprilie 2026, 13:21 | Scor/rezultat | Eroare de compilare |
existaimparedivimp.cpp: In function ‘int Di(int*, int, int)’: existaimparedivimp.cpp:4:28: error: expected ‘;’ before ‘else’ 4 | return (a[st]%2==1) | ^ | ; 5 | else | ~~~~ existaimparedivimp.cpp:7:21: error: ‘m’ was not declared in this scope 7 | m=(st+dr)/2; | ^ existaimparedivimp.cpp:8:33: error: expected primary-expression before ‘]’ token 8 | return Di(a[], st,m) or Di(a[], m+1, dr) | ^ existaimparedivimp.cpp:8:50: error: expected primary-expression before ‘]’ token 8 | return Di(a[], st,m) or Di(a[], m+1, dr) | ^ existaimparedivimp.cpp:8:61: error: expected ‘;’ at end of input 8 | return Di(a[], st,m) or Di(a[], m+1, dr) | ^ | ; existaimparedivimp.cpp:8:61: error: expected ‘}’ at end of input existaimparedivimp.cpp:6:17: note: to match this ‘{’ 6 | { | ^ existaimparedivimp.cpp:8:61: error: expected ‘}’ at end of input 8 | return Di(a[], st,m) or Di(a[], m+1, dr) | ^ existaimparedivimp.cpp:2:1: note: to match this ‘{’ 2 | { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ExistaImpareDivImp 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ă.