#519
Se dă un vector x cu n elemente, numere naturale, și un vector y cu m elemente, numere naturale. Să se verifice dacă vectorul y este secvență în vectorul x.
| Problema | Secventa1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64274697 | Utilizator | |
| Fișier | secventa1.cpp | Dimensiune | 470 B |
| Data încărcării | 27 Aprilie 2026, 15:22 | Scor/rezultat | Eroare de compilare |
secventa1.cpp: In function ‘int main()’: secventa1.cpp:6:21: error: conflicting declaration ‘int x [1001]’ 6 | {int i,j,n,m,x,ok=0,x[1001],y[1001]; | ^ secventa1.cpp:6:14: note: previous declaration as ‘int x’ 6 | {int i,j,n,m,x,ok=0,x[1001],y[1001]; | ^ secventa1.cpp:9:11: error: invalid types ‘int[int]’ for array subscript 9 | cin>>x[i]; | ^ secventa1.cpp:8:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(i=1;i<=n-m;i++) | ^~~ secventa1.cpp:10:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 10 | cin>>m; | ^~~ secventa1.cpp:11:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 11 | for(i=1;i<=n-m;i++) | ^~~ secventa1.cpp:13:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 13 | for(i=1;i<=n-m+1;i++) | ^~~ secventa1.cpp:14:8: error: invalid types ‘int[int]’ for array subscript 14 | if(x[i]==y[i]) | ^ secventa1.cpp:17:29: error: expected ‘]’ before ‘)’ token 17 | if(x[i+j-1!=y[j]) | ^ | ] secventa1.cpp:17:17: error: invalid types ‘int[bool]’ for array subscript 17 | if(x[i+j-1!=y[j]) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Secventa1 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ă.