#343
Soarece1
Se dă o tablă dreptunghiulară formată din n
linii și m
coloane, definind n*m
zone, unele dintre ele fiind libere, altele conținând obstacole. Într-o zonă precizată se află un șoarece care se poate deplasa pe tablă trecând din zona curentă în zona învecinată cu aceasta pe linie sau pe coloană. Scopul sau este să ajungă la o bucată de brânză aflată într-o zonă de asemenea precizată, fără a părăsi tabla, fără a trece prin zone care conțin obstacole și fără a trece de două ori prin aceeași zonă.
Determinați o modalitate prin care șoarecele poate să ajungă la bucata de brânză.
Problema | Soarece1 | Operații I/O |
soarece1.in /soarece1.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53341685 | Utilizator | |
Fișier | soarece1.cpp | Dimensiune | 1.44 KB |
Data încărcării | 25 Octombrie 2024, 09:14 | Scor / rezultat | Eroare de compilare |
soarece1.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout("soarece.out") ^ soarece1.cpp:7:14: warning: left operand of comma operator has no effect [-Wunused-value] int dx[]=(-1,0,1,-1); ^ soarece1.cpp:7:16: warning: right operand of comma operator has no effect [-Wunused-value] int dx[]=(-1,0,1,-1); ^ soarece1.cpp:7:19: warning: right operand of comma operator has no effect [-Wunused-value] int dx[]=(-1,0,1,-1); ^ soarece1.cpp:7:20: error: initializer fails to determine size of 'dx' int dx[]=(-1,0,1,-1); ^ soarece1.cpp:7:20: error: array must be initialized with a brace-enclosed initializer soarece1.cpp:8:14: warning: left operand of comma operator has no effect [-Wunused-value] int dy[]=(-1,0,1,-1); ^ soarece1.cpp:8:16: warning: right operand of comma operator has no effect [-Wunused-value] int dy[]=(-1,0,1,-1); ^ soarece1.cpp:8:19: warning: right operand of comma operator has no effect [-Wunused-value] int dy[]=(-1,0,1,-1); ^ soarece1.cpp:8:20: error: initializer fails to determine size of 'dy' int dy[]=(-1,0,1,-1); ^ soarece1.cpp:8:20: error: array must be initialized with a brace-enclosed initializer soarece1.cpp: In function 'void citire()': soarece1.cpp:12:10: error: 'n' was not declared in this scope fin>>n>>m; ^ soarece1.cpp:12:13: error: 'm' was not declared in this scope fin>>n>>m; ^ soarece1.cpp:16:20: error: 'a' was not declared in this scope if(c=='_') a[i][j]=0; ^ soarece1.cpp:16:22: error: 'i' was not declared in this scope if(c=='_') a[i][j]=0; ^ soarece1.cpp:16:25: error: 'j' was not declared in this scope if(c=='_') a[i][j]=0; ^ soarece1.cpp:17:20: error: 'a' was not declared in this scope if(c=='#') a[i][j]=1; ^ soarece1.cpp:17:22: error: 'i' was not declared in this scope if(c=='#') a[i][j]=1; ^ soarece1.cpp:17:25: error: 'j' was not declared in this scope if(c=='#') a[i][j]=1; ^ soarece1.cpp:20:17: error: 'a' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:20:19: error: 'i' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:20:22: error: 'j' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:21:17: error: 'is' was not declared in this scope is=i;js=j; ^ soarece1.cpp:21:22: error: 'js' was not declared in this scope is=i;js=j; ^ soarece1.cpp:25:13: error: 'a' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:25:15: error: 'i' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:25:18: error: 'j' was not declared in this scope a[i][j]=0; ^ soarece1.cpp:26:13: error: 'ib' was not declared in this scope ib=i; ^ soarece1.cpp:27:13: error: 'jb' was not declared in this scope jb=j; ^ soarece1.cpp: In function 'void afis()': soarece1.cpp:32:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ soarece1.cpp:34:24: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ soarece1.cpp:36:13: error: 'fout' was not declared in this scope fout<<a[i][j]; ^ soarece1.cpp:36:19: error: 'a' was not declared in this scope fout<<a[i][j]; ^ soarece1.cpp: In function 'void bkt(int, int, int)': soarece1.cpp:42:24: error: 'nr' was not declared in this scope for(int i=0;i<4 && nr==0 ;i++) ^ soarece1.cpp:46:29: error: 'n' was not declared in this scope if(xnou>=1 && xnou<=n && ynou>=1 && ynou<=m && a[xnou][ynou]==0) ^ soarece1.cpp:46:51: error: 'm' was not declared in this scope if(xnou>=1 && xnou<=n && ynou>=1 && ynou<=m && a[xnou][ynou]==0) ^ soarece1.cpp:46:56: error: 'a' was not declared in this scope if(xnou>=1 && xnou<=n && ynou>=1 && ynou<=m && a[xnou][ynou]==0) ^ soarece1.cpp:49:13: error: 'fout' was not declared in this scope fout<<xnou<<" "<<ynou<<endl; ^ soarece1.cpp:50:22: error: 'ib' was not declared in this scope if(xnou==ib && ynou==jb) ^ soarece1.cpp:50:34: error: 'jb' was not declared in this scope if(xnou==ib && ynou==jb) ^ soarece1.cpp:54:13: error: expected ';' before '}' token } ^ soarece1.cpp: In function 'int main()': soarece1.cpp:67:5: error: 'a' was not declared in this scope a[is][js]=1; ^ soarece1.cpp:67:7: error: 'is' was not declared in this scope a[is][js]=1; ^ soarece1.cpp:67:11: error: 'js' was not declared in this scope a[is][js]=1; ^ soarece1.cpp:69:8: error: 'nr' was not declared in this scope if(nr==0) ^ soarece1.cpp:70:25: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ soarece1.cpp:71:25: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ soarece1.cpp:72:10: error: 'fout' was not declared in this scope fout ^ soarece1.cpp:73:5: error: expected ';' before 'return' return 0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Soarece1 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ă.