#752
Se consideră un arbore binar alocat dinamic în care nodurile memorează numere naturale nenule. Să se determine valorile memorate în descendenții direcți ai rădăcinii arborelui.
Programul citește lista valorilor din arbore, data în ordinea parcurgerii în preordine.
| Problema | BiArbore | Operații I/O |
biarbore.in/biarbore.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64462872 | Utilizator | |
| Fișier | biarbore.cpp | Dimensiune | 2.73 KB |
| Data încărcării | 08 Mai 2026, 10:09 | Scor/rezultat | Eroare de compilare |
biarbore.cpp:8:18: warning: missing terminating " character 8 | ifstream fin(" #include <iostream> | ^ biarbore.cpp:8:18: error: missing terminating " character 8 | ifstream fin(" #include <iostream> | ^~~~~~~~~~~~~~~~~~~~~~~~ biarbore.cpp:58:4: warning: missing terminating " character 58 | .in"); | ^ biarbore.cpp:58:4: error: missing terminating " character 58 | .in"); | ^~~ biarbore.cpp:59:19: warning: missing terminating " character 59 | ofstream fout(" #include <iostream> | ^ biarbore.cpp:59:19: error: missing terminating " character 59 | ofstream fout(" #include <iostream> | ^~~~~~~~~~~~~~~~~~~~~~~~ biarbore.cpp:109:5: warning: missing terminating " character 109 | .out"); | ^ biarbore.cpp:109:5: error: missing terminating " character 109 | .out"); | ^~~ biarbore.cpp:14:5: error: expected primary-expression before ‘using’ 14 | using namespace std; | ^~~~~ biarbore.cpp:15:14: error: redefinition of ‘std::ifstream fin’ 15 | ifstream fin("jipa.in"); | ^~~ biarbore.cpp:8:14: note: ‘std::ifstream fin’ previously declared here 8 | ifstream fin(" #include <iostream> | ^~~ biarbore.cpp: In function ‘void creare(nod*&)’: biarbore.cpp:41:16: warning: statement has no effect [-Wunused-value] 41 | rad==NULL; | ^ biarbore.cpp: At global scope: biarbore.cpp:58:1: error: expected unqualified-id before ‘.’ token 58 | .in"); | ^ biarbore.cpp:66:14: error: redefinition of ‘std::ifstream fin’ 66 | ifstream fin("jipa.in"); | ^~~ biarbore.cpp:8:14: note: ‘std::ifstream fin’ previously declared here 8 | ifstream fin(" #include <iostream> | ^~~ biarbore.cpp:67:14: error: redefinition of ‘std::ofstream fout’ 67 | ofstream fout("jipa.out"); | ^~~~ biarbore.cpp:16:14: note: ‘std::ofstream fout’ previously declared here 16 | ofstream fout("jipa.out"); | ^~~~ biarbore.cpp:68:9: error: redefinition of ‘int st [1001]’ 68 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~ biarbore.cpp:17:9: note: ‘int st [1001]’ previously declared here 17 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~ biarbore.cpp:68:18: error: redefinition of ‘int dr [1011]’ 68 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~ biarbore.cpp:17:18: note: ‘int dr [1011]’ previously declared here 17 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~ biarbore.cpp:68:27: error: redefinition of ‘int val [1011]’ 68 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~~ biarbore.cpp:17:27: note: ‘int val [1011]’ previously declared here 17 | int st[1001],dr[1011],val[1011],d[1000],n; | ^~~ biarbore.cpp:68:37: error: redefinition of ‘int d [1000]’ 68 | int st[1001],dr[1011],val[1011],d[1000],n; | ^ biarbore.cpp:17:37: note: ‘int d [1000]’ previously declared here 17 | int st[1001],dr[1011],val[1011],d[1000],n; | ^ biarbore.cpp:68:45: error: redefinition of ‘int n’ 68 | int st[1001],dr[1011],val[1011],d[1000],n; | ^ biarbore.cpp:17:45: note: ‘int n’ previously declared here 17 | int st[1001],dr[1011],val[1011],d[1000],n; | ^ biarbore.cpp:69:9: error: redefinition of ‘int prim(int)’ 69 | int prim(int k) | ^~~~ biarbore.cpp:18:9: note: ‘int prim(int)’ previously defined here 18 | int prim(int k) | ^~~~ biarbore.cpp:82:12: error: redefinition of ‘struct nod’ 82 | struct nod{ | ^~~ biarbore.cpp:31:12: note: previous definition of ‘struct nod’ 31 | struct nod{ | ^~~ biarbore.cpp:85:7: error: conflicting declaration ‘int* rad’ 85 | }*rad; | ^~~ biarbore.cpp:34:7: note: previous declaration as ‘nod* rad’ 34 | }*rad; | ^~~ biarbore.cpp:87:10: error: redefinition of ‘void creare(nod*&)’ 87 | void creare (nod *&rad) | ^~~~~~ biarbore.cpp:36:10: note: ‘void creare(nod*&)’ previously defined here 36 | void creare (nod *&rad) | ^~~~~~ biarbore.cpp: In function ‘void creare(nod*&)’: biarbore.cpp:92:16: warning: statement has no effect [-Wunused-value] 92 | rad==NULL; | ^ biarbore.cpp: At global scope: biarbore.cpp:102:9: error: redefinition of ‘int main()’ 102 | int main() | ^~~~ biarbore.cpp:51:9: note: ‘int main()’ previously defined here 51 | int main() | ^~~~ biarbore.cpp:109:1: error: expected unqualified-id before ‘.’ token 109 | .out"); | ^ biarbore.cpp:111:9: error: redefinition of ‘int prim(int)’ 111 | int prim(int k) | ^~~~ biarbore.cpp:18:9: note: ‘int prim(int)’ previously defined here 18 | int prim(int k) | ^~~~ biarbore.cpp:124:12: error: redefinition of ‘struct nod’ 124 | struct nod{ | ^~~ biarbore.cpp:31:12: note: previous definition of ‘struct nod’ 31 | struct nod{ | ^~~ biarbore.cpp:127:7: error: conflicting declaration ‘int* rad’ 127 | }*rad; | ^~~ biarbore.cpp:34:7: note: previous declaration as ‘nod* rad’ 34 | }*rad; | ^~~ biarbore.cpp:129:10: error: redefinition of ‘void creare(nod*&)’ 129 | void creare (nod *&rad) | ^~~~~~ biarbore.cpp:36:10: note: ‘void creare(nod*&)’ previously defined here 36 | void creare (nod *&rad) | ^~~~~~ biarbore.cpp: In function ‘void creare(nod*&)’: biarbore.cpp:134:16: warning: statement has no effect [-Wunused-value] 134 | rad==NULL; | ^ biarbore.cpp: At global scope: biarbore.cpp:144:9: error: redefinition of ‘int main()’ 144 | int main() | ^~~~ biarbore.cpp:51:9: note: ‘int main()’ previously defined here 51 | int main() | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BiArbore 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ă.