#756
Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se determine câte noduri din arbore au un singur descendent direct.
Programul citește lista valorilor din arbore, dată în ordinea parcurgerii în preordine.
| Problema | NrNod | Operații I/O |
nrnod.in/nrnod.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64456784 | Utilizator | |
| Fișier | nrnod.cpp | Dimensiune | 938 B |
| Data încărcării | 07 Mai 2026, 21:10 | Scor/rezultat | Eroare de compilare |
nrnod.cpp: In function ‘int Citire()’: nrnod.cpp:22:15: error: ‘creare’ was not declared in this scope 22 | st[nod] = creare(); | ^~~~~~ nrnod.cpp: In function ‘int radacina()’: nrnod.cpp:37:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 37 | for(int i=1; i<=n; i++) | ^~~ nrnod.cpp:39:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 39 | return 0; | ^~~~~~ nrnod.cpp: At global scope: nrnod.cpp:47:14: error: ‘void hr(int)’ redeclared as different kind of entity 47 | void hr(int x) | ^ nrnod.cpp:7:47: note: previous declaration ‘int hr’ 7 | int n, st[N], dr[N], v[N], k,cnt[N],i,cnt1,nr,hr; | ^~ nrnod.cpp: In function ‘void hr(int)’: nrnod.cpp:50:17: error: ‘hr’ cannot be used as a function 50 | if(st[x]) hr(st[x]); | ~~^~~~~~~ nrnod.cpp:51:17: error: ‘hr’ cannot be used as a function 51 | if(dr[x]) hr(dr[x]); | ~~^~~~~~~ nrnod.cpp: In function ‘int main()’: nrnod.cpp:57:13: error: ‘hr’ cannot be used as a function 57 | fout<<hr(f); | ~~^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrNod 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ă.