#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 | #64408467 | Utilizator | |
| Fișier | constr2.cpp | Dimensiune | 516 B |
| Data încărcării | 05 Mai 2026, 15:23 | Scor/rezultat | Eroare de compilare |
constr2.cpp: In function ‘int prim()’: constr2.cpp:5:8: error: ‘x’ was not declared in this scope 5 | if(x<2) | ^ constr2.cpp:7:8: error: ‘x’ was not declared in this scope 7 | if(x==2) | ^ constr2.cpp:9:8: error: ‘x’ was not declared in this scope 9 | if(x%2==0) | ^ constr2.cpp:11:22: error: ‘x’ was not declared in this scope 11 | for(int i=3;i*i<=x;i+=2) | ^ constr2.cpp: In function ‘int main()’: constr2.cpp:23:14: error: ‘v’ was not declared in this scope 23 | cin>>v[i]; | ^ constr2.cpp:26:6: error: ‘m’ was not declared in this scope 26 | m=0; | ^ constr2.cpp:28:17: error: too many arguments to function ‘int prim()’ 28 | if(prim (x[i])) | ~~~~~^~~~~~ constr2.cpp:3:5: note: declared here 3 | int prim() | ^~~~ constr2.cpp:29:1: error: expected primary-expression before ‘}’ token 29 | } | ^ constr2.cpp:19:16: warning: unused variable ‘y’ [-Wunused-variable] 19 | int x[200],y[200],n,i; | ^
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ă.