#670
Se dă un arbore binar care conține valori numere naturale. Să se afișeze valorile din arbore în urma parcurgerii în preordine.
Notă: pentru reprezentarea arborelui se recomandă alocarea statică, folosind tablouri.
| Problema | Preordine | Operații I/O |
preordine.in/preordine.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64204149 | Utilizator | |
| Fișier | preordine.cpp | Dimensiune | 1.68 KB |
| Data încărcării | 22 Aprilie 2026, 20:06 | Scor/rezultat | Eroare de compilare |
preordine.cpp:61:2: error: stray ‘#’ in program 61 | }#include <iostream> | ^ preordine.cpp:61:3: error: ‘include’ does not name a type 61 | }#include <iostream> | ^~~~~~~ preordine.cpp:66:8: error: redefinition of ‘struct nod’ 66 | struct nod | ^~~ preordine.cpp:6:8: note: previous definition of ‘struct nod’ 6 | struct nod | ^~~ preordine.cpp:72:5: error: redefinition of ‘nod arb [1001]’ 72 | nod arb[1001]; | ^~~ preordine.cpp:12:5: note: ‘nod arb [1001]’ previously declared here 12 | nod arb[1001]; | ^~~ preordine.cpp:73:5: error: redefinition of ‘int n’ 73 | int n, rad; | ^ preordine.cpp:13:5: note: ‘int n’ previously declared here 13 | int n, rad; | ^ preordine.cpp:73:8: error: redefinition of ‘int rad’ 73 | int n, rad; | ^~~ preordine.cpp:13:8: note: ‘int rad’ previously declared here 13 | int n, rad; | ^~~ preordine.cpp:74:5: error: redefinition of ‘int T [1001]’ 74 | int T[1001]; | ^ preordine.cpp:14:5: note: ‘int T [1001]’ previously declared here 14 | int T[1001]; | ^ preordine.cpp:76:10: error: redefinition of ‘std::ifstream f’ 76 | ifstream f("preordine.in"); | ^ preordine.cpp:16:10: note: ‘std::ifstream f’ previously declared here 16 | ifstream f("preordine.in"); | ^ preordine.cpp:77:10: error: redefinition of ‘std::ofstream g’ 77 | ofstream g("preordine.out"); | ^ preordine.cpp:17:10: note: ‘std::ofstream g’ previously declared here 17 | ofstream g("preordine.out"); | ^ preordine.cpp:79:6: error: redefinition of ‘void citire()’ 79 | void citire() | ^~~~~~ preordine.cpp:19:6: note: ‘void citire()’ previously defined here 19 | void citire() | ^~~~~~ preordine.cpp:94:6: error: redefinition of ‘void detRad()’ 94 | void detRad() | ^~~~~~ preordine.cpp:34:6: note: ‘void detRad()’ previously defined here 34 | void detRad() | ^~~~~~ preordine.cpp:103:6: error: redefinition of ‘void preordine(int)’ 103 | void preordine(int r) | ^~~~~~~~~ preordine.cpp:43:6: note: ‘void preordine(int)’ previously defined here 43 | void preordine(int r) | ^~~~~~~~~ preordine.cpp:113:5: error: redefinition of ‘int main()’ 113 | int main() | ^~~~ preordine.cpp:53:5: note: ‘int main()’ previously defined here 53 | int main() | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Preordine 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ă.