#2825
Scrieți un program C/C++ care citește de la tastatură numere naturale din intervalul [3, 100], în această ordine: n și m, apoi elementele unui tablou bidimensional cu n linii și m coloane, iar la final un număr x.
Programul afișează pe ecran mesajul DA, dacă există cel puțin un element egal cu x aflat pe conturul tabloului (format din prima linie, ultima linie, prima coloană și ultima coloană), sau mesajul NU în caz contrar.
Subiect Bacalaureat 2016, sesiunea august-septembrie
| Problema | Chenar2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64427286 | Utilizator | |
| Fișier | chenar2.cpp | Dimensiune | 643 B |
| Data încărcării | 06 Mai 2026, 12:40 | Scor/rezultat | Eroare de compilare |
chenar2.cpp:3:1: error: ‘in’ does not name a type; did you mean ‘int’? 3 | in n,m,x,a[1001][1001],s,i,j,c; | ^~ | int chenar2.cpp: In function ‘int main()’: chenar2.cpp:6:10: error: ‘n’ was not declared in this scope 6 | cin>>n>>m; | ^ chenar2.cpp:6:13: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 6 | cin>>n>>m; | ^ | tm chenar2.cpp:7:9: error: ‘i’ was not declared in this scope 7 | for(i=1;i<=n;i++) | ^ chenar2.cpp:8:10: error: ‘j’ was not declared in this scope 8 | for(j=1;j<=m;j++) | ^ chenar2.cpp:9:14: error: ‘a’ was not declared in this scope 9 | cin>>a[i][j]; ok==1; | ^ chenar2.cpp:8:6: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(j=1;j<=m;j++) | ^~~ chenar2.cpp:9:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 9 | cin>>a[i][j]; ok==1; | ^~ chenar2.cpp:9:23: error: ‘ok’ was not declared in this scope chenar2.cpp:10:14: error: ‘x’ was not declared in this scope 10 | cin>>x; | ^ chenar2.cpp:11:9: error: ‘j’ was not declared in this scope 11 | for(j=1;j<=m;j++) | ^ chenar2.cpp:13:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 13 | if(a[1][j]==x; | ^ chenar2.cpp:13:12: error: ‘a’ was not declared in this scope chenar2.cpp:14:16: error: expected ‘)’ before ‘;’ token 14 | ok=1; | ^ | ) chenar2.cpp:13:11: note: to match this ‘(’ 13 | if(a[1][j]==x; | ^ chenar2.cpp:13:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 13 | if(a[1][j]==x; | ^~ chenar2.cpp:15:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 15 | if(a[i][n]==x; | ^~ chenar2.cpp:15:15: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 15 | if(a[i][n]==x; | ^ chenar2.cpp:15:15: error: ‘a’ was not declared in this scope chenar2.cpp:15:17: error: ‘i’ was not declared in this scope 15 | if(a[i][n]==x; | ^ chenar2.cpp:16:19: error: expected ‘)’ before ‘;’ token 16 | ok=1; | ^ | ) chenar2.cpp:15:14: note: to match this ‘(’ 15 | if(a[i][n]==x; | ^ chenar2.cpp:19:9: error: ‘i’ was not declared in this scope 19 | for(i=2;i<=n;i++) | ^ chenar2.cpp:21:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 21 | if(a[i][1]==x; | ^ chenar2.cpp:21:12: error: ‘a’ was not declared in this scope chenar2.cpp:22:16: error: expected ‘)’ before ‘;’ token 22 | ok=1; | ^ | ) chenar2.cpp:21:11: note: to match this ‘(’ 21 | if(a[i][1]==x; | ^ chenar2.cpp:21:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 21 | if(a[i][1]==x; | ^~ chenar2.cpp:23:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 23 | if(a[i][m]==x; | ^~ chenar2.cpp:23:15: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 23 | if(a[i][m]==x; | ^ chenar2.cpp:23:15: error: ‘a’ was not declared in this scope chenar2.cpp:24:19: error: expected ‘)’ before ‘;’ token 24 | ok=1; | ^ | ) chenar2.cpp:23:14: note: to match this ‘(’ 23 | if(a[i][m]==x; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Chenar2 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ă.