#1154
CautareDivImp
Se dă un vector x
cu n
elemente numere naturale, și un vector y
cu m
elemente, de asemenea numere naturale. Folosind metoda Divide et Impera, verificați pentru fiecare element al vectorului y
dacă apare în x
.
Problema | CautareDivImp | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54643395 | Utilizator | |
Fișier | cautaredivimp.cpp | Dimensiune | 745 B |
Data încărcării | 04 Decembrie 2024, 13:38 | Scor / rezultat | Eroare de compilare |
cautaredivimp.cpp:7:19: error: 'b' has not been declared int caut(int a[], b[], int st, int dr, int x,int y) ^ cautaredivimp.cpp: In function 'int caut(int*, int*, int, int, int, int)': cautaredivimp.cpp:15:16: error: 'b' was not declared in this scope if(b[mijl]==y) ^ cautaredivimp.cpp:18:15: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(a[mijl]<x) ^ cautaredivimp.cpp:14:11: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(a[mijl]==x) ^ cautaredivimp.cpp: In function 'int main()': cautaredivimp.cpp:28:11: error: 'm' was not declared in this scope cin>>n>>m>>x>>y; ^ cautaredivimp.cpp:28:17: error: 'y' was not declared in this scope cin>>n>>m>>x>>y; ^ cautaredivimp.cpp:32:11: warning: capture of variable 'i' with non-automatic storage duration [enabled by default] cin>>[i]; ^ cautaredivimp.cpp:5:12: note: 'int i' declared here int a[101],i,n,x; ^ cautaredivimp.cpp: In lambda function: cautaredivimp.cpp:32:13: error: expected '{' before ';' token cin>>[i]; ^ cautaredivimp.cpp: In function 'int main()': cautaredivimp.cpp:32:8: error: ambiguous overload for 'operator>>' (operand types are 'std::istream {aka std::basic_istream<char>}' and 'main()::__lambda0') cin>>[i]; ^ cautaredivimp.cpp:32:8: note: candidates are: In file included from /usr/include/c++/4.8/iostream:40:0, from cautaredivimp.cpp:1: /usr/include/c++/4.8/istream:120:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(__istream_type& (*__pf)(__istream_type&)) ^ /usr/include/c++/4.8/istream:120:7: note: no known conversion for argument 1 from 'main()::__lambda0' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}' /usr/include/c++/4.8/istream:124:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator>>(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/4.8/istream:124:7: note: no known conversion for argument 1 from 'main()::__lambda0' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' /usr/include/c++/4.8/istream:131:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(ios_base& (*__pf)(ios_base&)) ^ /usr/include/c++/4.8/istream:131:7: note: no known conversion for argument 1 from 'main()::__lambda0' to 'std::ios_base& (*)(std::ios_base&)' cautaredivimp.cpp:35:13: error: 'b' was not declared in this scope if(caut(a,b,0,n-1,x,y)==-1) ^ cautaredivimp.cpp:38:51: error: too few arguments to function 'int caut(int*, int*, int, int, int, int)' cout<<"se gaseste pe pozitia "<<caut(a,0,n-1,x); ^ cautaredivimp.cpp:7:5: note: declared here int caut(int a[], b[], int st, int dr, int x,int y) ^ cautaredivimp.cpp: In function 'int caut(int*, int*, int, int, int, int)': cautaredivimp.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CautareDivImp 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ă.