#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 | #64310211 | Utilizator | |
| Fișier | poza.cpp | Dimensiune | 967 B |
| Data încărcării | 29 Aprilie 2026, 08:49 | Scor/rezultat | Eroare de compilare |
poza.cpp:3:41: error: ‘q’ does not name a type 3 | int li,lf,ci,cf,p,i,f,n,m,a[101][101],j;q; | ^ poza.cpp: In function ‘int main()’: poza.cpp:7:22: error: expected ‘)’ before ‘{’ token 7 | if(a[i][j]==1 | ~ ^ | ) 8 | {li=i; | ~ poza.cpp:7:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 7 | if(a[i][j]==1 | ^~ poza.cpp:11:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 11 | for(j=1;j<+n;j++) | ^ poza.cpp:11:21: warning: statement has no effect [-Wunused-value] 11 | for(j=1;j<+n;j++) | ~^~~ poza.cpp:11:28: error: expected ‘;’ before ‘)’ token 11 | for(j=1;j<+n;j++) | ^ | ; poza.cpp:12:21: warning: statement has no effect [-Wunused-value] 12 | for(i=1;i<=n;i++) | ~^~~ poza.cpp:12:28: error: expected ‘;’ before ‘)’ token 12 | for(i=1;i<=n;i++) | ^ | ; poza.cpp:16:46: error: expected ‘)’ before ‘if’ 16 | for(i=n;i>=1;i--) for(j=m;j>=1;j-- | ~ ^ | ) 17 | if(a[i][j]==1) {lf=i;i=0;j=0;} | ~~ poza.cpp:18:30: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 18 | for(j=m;j>=1;j--) for(i=n;i>=1;i--) | ^~~ poza.cpp:20:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 20 | p=lf-li+1;q=cf-ci+1; | ^ poza.cpp:20:44: error: ‘q’ was not declared in this scope 20 | p=lf-li+1;q=cf-ci+1; | ^
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ă.