#4260
Folosind metoda Divide et Impera, scrieți funcția recursivă cu antetul
int NrXDivImp(int a[], int st, int dr, int x)
care primind ca parametri un vector a
de numere întregi și trei numere întregi st
, dr
și x
, returnează numărul de apariții ale numărului x
în vectorul secvența a[st], a[st+1], ..., a[dr]
.
Problema | NrXDivImp | Operații I/O |
![]() nrxdivimp.in /nrxdivimp.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58457891 | Utilizator | |
Fișier | nrxdivimp.cpp | Dimensiune | 336 B |
Data încărcării | 06 Iunie 2025, 13:05 | Scor / rezultat | Eroare de compilare |
nrxdivimp.cpp: In function 'int NrXDivImp(int*, int, int, int)': nrxdivimp.cpp:12:39: error: expected primary-expression before 'int' int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:46: error: expected primary-expression before 'int' int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:54: error: expected primary-expression before 'int' int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:61: error: expected primary-expression before 'int' int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:13: warning: unused variable 'n' [-Wunused-variable] int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:16: warning: unused variable 'nr2' [-Wunused-variable] int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:21: warning: unused variable 'm' [-Wunused-variable] int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:12:24: warning: unused variable 'nr1' [-Wunused-variable] int n, nr2, m, nr1=NrXDivImp( int a, int st, int m, int x) ^ nrxdivimp.cpp:14:8: error: 'nr1' was not declared in this scope nr1=NrXDivImp(a,st,m,x); ^ nrxdivimp.cpp:14:27: error: 'm' was not declared in this scope nr1=NrXDivImp(a,st,m,x); ^ nrxdivimp.cpp:15:8: error: 'nr2' was not declared in this scope nr2=NrXDivImp(a,m+1,dr,x); ^ nrxdivimp.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrXDivImp face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.