#597
Fie o poză dată sub forma unei matrice cu n linii și m coloane, în care elementele sunt 0 sau 1: un element 0 reprezintă fundalul imaginii, iar un element 1 reprezintă obiect din prim plan. Este necesară tăierea unei bucăți din imagine astfel încât:
Determinați dimensiunile pozei tăiate, precum și conținutul ei.
| Problema | Poza | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64309824 | Utilizator | |
| Fișier | poza.cpp | Dimensiune | 878 B |
| Data încărcării | 29 Aprilie 2026, 08:42 | Scor/rezultat | Eroare de compilare |
poza.cpp: In function ‘int main()’: poza.cpp:5:6: error: ‘n’ was not declared in this scope 5 | cin>>n,m; | ^ poza.cpp:9:37: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 9 | for(j=1;j<=m;j++) if(a[i][j]=1) | ~~~~~~~^~ poza.cpp:18:25: warning: right operand of comma operator has no effect [-Wunused-value] 18 | for(j=m,j>=1;j--) | ~^~~ poza.cpp:18:32: error: expected ‘;’ before ‘)’ token 18 | for(j=m,j>=1;j--) | ^ | ; poza.cpp:20:16: error: expected ‘(’ before numeric constant 20 | {if 2 i;i=0;j=0) | ^ | ( poza.cpp:20:27: error: expected ‘;’ before ‘)’ token 20 | {if 2 i;i=0;j=0) | ^ | ; poza.cpp:21:25: warning: statement has no effect [-Wunused-value] 21 | for(j=m;j>=1;j--) for(i=n;i>=1;i--) | ~^~~ poza.cpp:21:32: error: expected ‘;’ before ‘)’ token 21 | for(j=m;j>=1;j--) for(i=n;i>=1;i--) | ^ | ; poza.cpp:21:43: warning: statement has no effect [-Wunused-value] 21 | for(j=m;j>=1;j--) for(i=n;i>=1;i--) | ~^~~ poza.cpp:21:50: error: expected ‘;’ before ‘)’ token 21 | for(j=m;j>=1;j--) for(i=n;i>=1;i--) | ^ | ; poza.cpp:26:22: error: expected ‘;’ before ‘a’ 26 | cout a[i][j]<<" "; | ^~ | ; poza.cpp:26:18: warning: statement has no effect [-Wunused-value] 26 | cout a[i][j]<<" "; | ^~~~ poza.cpp:25:33: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 25 | for(i=li;i<=lf;i++)for(j=ci;j<=cf;j++) | ^~~ poza.cpp:27:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 27 | cout<<endl;} | ^~~~ poza.cpp:28:26: error: expected ‘;’ before ‘:’ token 28 | return 0:} | ^ | ; poza.cpp:28:26: error: expected primary-expression before ‘:’ token
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Poza 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ă.