#329
Se consideră o tablă de joc de formă dreptunghiulară, împărţită în n linii şi m coloane. Se obţin astfel n*m zone şi se cunoaște înălțimea fiecărei zone. La o poziție cunoscută – linia istart, coloana jstart se află o bilă care se poate deplasa pe o poziție vecină (sus, jos, stânga, dreapta) doar dacă înălțimea poziției vecine este strict mai mică decât înălțimea poziției curente.
Determinați numărul maxim de zone prin care poate să treacă bila pentru a ajunge pe una dintre marginile tablei de joc.
| Problema | Bila | Operații I/O |
bila.in/bila.out
|
|---|---|---|---|
| Limita timp | 0.8 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #60608750 | Utilizator | |
| Fișier | bila.cpp | Dimensiune | 4.26 KB |
| Data încărcării | 06 Noiembrie 2025, 10:30 | Scor/rezultat | Eroare de compilare |
bila.cpp:71:2: error: stray '#' in program }#include <iostream> ^ bila.cpp:167:14: error: stray '#' in program x[0][2]=j#include <iostream> ^ bila.cpp:71:3: error: 'include' does not name a type }#include <iostream> ^ bila.cpp:74:11: error: redefinition of 'std::ifstream f' ifstream f("bila.in"); ^ bila.cpp:4:10: error: 'std::ifstream f' previously declared here ifstream f("bila.in"); ^ bila.cpp:75:11: error: redefinition of 'std::ofstream g' ofstream g("bila.out"); ^ bila.cpp:5:10: error: 'std::ofstream g' previously declared here ofstream g("bila.out"); ^ bila.cpp:76:5: error: redefinition of 'int n' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:5: error: 'int n' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:7: error: redefinition of 'int m' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:7: error: 'int m' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:17: error: redefinition of 'int x [200][4]' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:9: error: 'int x [200][4]' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:29: error: redefinition of 'int a [100][100]' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:19: error: 'int a [100][100]' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:31: error: redefinition of 'int istart' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:31: error: 'int istart' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:38: error: redefinition of 'int jstart' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:38: error: 'int jstart' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:45: error: redefinition of 'int i' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:45: error: 'int i' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:47: error: redefinition of 'int j' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:47: error: 'int j' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp:76:49: error: redefinition of 'int mx' int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:6:49: error: 'int mx' previously declared here int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx; ^ bila.cpp: In function 'int succ(int)': bila.cpp:77:5: error: redefinition of 'int succ(int)' int succ(int k) ^ bila.cpp:7:5: error: 'int succ(int)' previously defined here int succ(int k) ^ bila.cpp: In function 'int valid(int)': bila.cpp:86:5: error: redefinition of 'int valid(int)' int valid(int k) ^ bila.cpp:16:5: error: 'int valid(int)' previously defined here int valid(int k) ^ bila.cpp: In function 'int solutie(int)': bila.cpp:110:5: error: redefinition of 'int solutie(int)' int solutie(int k) ^ bila.cpp:40:5: error: 'int solutie(int)' previously defined here int solutie(int k) ^ bila.cpp: In function 'void afis(int)': bila.cpp:117:6: error: redefinition of 'void afis(int)' void afis(int k) ^ bila.cpp:47:6: error: 'void afis(int)' previously defined here void afis(int k) ^ bila.cpp: In function 'void back()': bila.cpp:122:6: error: redefinition of 'void back()' void back() ^ bila.cpp:52:6: error: 'void back()' previously defined here void back() ^ bila.cpp:134:35: error: expected ';' before 'afis' if(solutie(k)) { ct++ afis(k);} ^ bila.cpp: In function 'int main()': bila.cpp:159:5: error: redefinition of 'int main()' int main() ^ bila.cpp:142:5: error: 'int main()' previously defined here int main() ^ bila.cpp:167:15: error: expected ';' before 'include' x[0][2]=j#include <iostream> ^ bila.cpp:174:1: error: a function-definition is not allowed here before '{' token { ^ bila.cpp:172:5: warning: unused variable 'n' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:7: warning: unused variable 'm' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:9: warning: unused variable 'x' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:19: warning: unused variable 'a' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:31: warning: unused variable 'istart' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:38: warning: unused variable 'jstart' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:45: warning: unused variable 'i' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:47: warning: unused variable 'j' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:49: warning: unused variable 'mx' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:172:52: warning: unused variable 'ct' [-Wunused-variable] int n,m,x[200][4],a[100][100],istart,jstart,i,j,mx,ct=0; ^ bila.cpp:253:1: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Bila 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ă.