#674
Se dă un arbore binar care conține valori numere naturale. Se dau k
noduri din arbore și se cere determinarea, pentru fiecare nod, a numărului de noduri din subarborele cu rădăcina în acel nod.
Notă: pentru reprezentarea arborelui se recomandă alocarea statică, folosind tablouri.
Problema | CountSub | Operații I/O |
![]() countsub.in /countsub.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57193953 | Utilizator | |
Fișier | countsub.cpp | Dimensiune | 574 B |
Data încărcării | 19 Martie 2025, 18:49 | Scor / rezultat | Eroare de compilare |
countsub.cpp:7:1: error: expected ',' or ';' before 'int' int n,c[1001],dr[1001],st[1001],s,k,nod[1001]; ^ countsub.cpp: In function 'int parc(int)': countsub.cpp:12:17: error: 'dr' was not declared in this scope return parc(dr[r])+parc(st[r])+1; ^ countsub.cpp:12:29: error: 'st' was not declared in this scope return parc(dr[r])+parc(st[r])+1; ^ countsub.cpp: In function 'int main()': countsub.cpp:15:7: error: 'n' was not declared in this scope {fin>>n; ^ countsub.cpp:18:14: error: 'c' was not declared in this scope fin>>c[i]>>dr[i]>>st[i]; ^ countsub.cpp:18:20: error: 'dr' was not declared in this scope fin>>c[i]>>dr[i]>>st[i]; ^ countsub.cpp:18:27: error: 'st' was not declared in this scope fin>>c[i]>>dr[i]>>st[i]; ^ countsub.cpp:20:10: error: 'k' was not declared in this scope fin>>k; ^ countsub.cpp:23:14: error: 'nod' was not declared in this scope fin>>nod[i]; ^ countsub.cpp:27:19: error: 'nod' was not declared in this scope fout<<parc(nod[i])<<endl; ^ countsub.cpp: In function 'int parc(int)': countsub.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CountSub 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ă.