#672
Se dă un arbore binar care conține valori numere naturale. Să se afișeze valorile din arbore în urma parcurgerii în postordine.
Notă: pentru reprezentarea arborelui se recomandă alocarea statică, folosind tablouri.
| Problema | Postordine | Operații I/O |
postordine.in/postordine.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64620823 | Utilizator | |
| Fișier | postordine.cpp | Dimensiune | 589 B |
| Data încărcării | 19 Mai 2026, 07:46 | Scor/rezultat | 100 puncte |
postordine.cpp: In function ‘int main()’: postordine.cpp:25:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 25 | for(int i=1;i<=n;i++) | ^~~ postordine.cpp:28:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 28 | SDR(r); | ^~~ postordine.cpp:17:11: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | fscanf(f,"%d",&n); | ~~~~~~^~~~~~~~~~~ postordine.cpp:20:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | fscanf(f,"%d%d%d",&inf[i],&st[i],&dr[i]); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘void SDR(int)’, inlined from ‘int main()’ at postordine.cpp:28:12: postordine.cpp:7:5: warning: ‘r’ may be used uninitialized [-Wmaybe-uninitialized] 7 | if(r!=0) | ^~ postordine.cpp: In function ‘int main()’: postordine.cpp:16:9: note: ‘r’ was declared here 16 | int r; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 40 | 40 | ||
| 3 | 0.001 secunde | OK. | 40 | 40 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Postordine 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ă.