#495
Se dă un vector x cu n elemente, numere naturale. Să se construiască un alt vector, y, care să conțină elementele prime din x, în ordine inversă.
| Problema | Constr2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64459401 | Utilizator | |
| Fișier | constr2.cpp | Dimensiune | 429 B |
| Data încărcării | 08 Mai 2026, 08:29 | Scor/rezultat | Eroare de compilare |
constr2.cpp: In function ‘int main()’: constr2.cpp:5:11: error: expected unqualified-id before ‘[’ token 5 | int x,[201],n,y[m],m=0; | ^ constr2.cpp:6:10: error: ‘n’ was not declared in this scope 6 | cin>>n; | ^ constr2.cpp:8:15: error: invalid types ‘int[int]’ for array subscript 8 | cin>>x[i]; | ^ constr2.cpp:13:28: error: invalid types ‘int[int]’ for array subscript 13 | for (int d=2;d*d<=x[i];d++) | ^ constr2.cpp:15:18: error: invalid types ‘int[int]’ for array subscript 15 | if (x[i]%d==0)nd++; | ^ constr2.cpp:17:20: error: ‘y’ was not declared in this scope 17 | if (nd==2) y[m]=x[i]; | ^ constr2.cpp:17:22: error: ‘m’ was not declared in this scope 17 | if (nd==2) y[m]=x[i]; | ^ constr2.cpp:17:26: error: invalid types ‘int[int]’ for array subscript 17 | if (nd==2) y[m]=x[i]; | ^ constr2.cpp:18:9: error: ‘m’ was not declared in this scope 18 | m++; | ^ constr2.cpp:22:21: error: ‘m’ was not declared in this scope 22 | for (int i=1;i<=m;i++){ | ^ constr2.cpp:23:15: error: ‘y’ was not declared in this scope 23 | cout<<y[i]; | ^ constr2.cpp:24:6: error: expected ‘}’ at end of input 24 | } | ^ constr2.cpp:4:1: note: to match this ‘{’ 4 | { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Constr2 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ă.