#673
DifSub
Se dă un arbore binar care conține valori numere naturale. Să se determine diferența în valoare absolută a sumei valorilor memorate în subarborele stâng al rădăcinii și suma valorilor memorate în subarborele drept al rădăcinii.
Problema | DifSub | Operații I/O |
difsub.in /difsub.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54571790 | Utilizator | |
Fișier | difsub.cpp | Dimensiune | 842 B |
Data încărcării | 02 Decembrie 2024, 19:33 | Scor / rezultat | Eroare de compilare |
difsub.cpp:6:10: error: 'NMax' was not declared in this scope int info[NMax], n, st[NMax], dr[NMax]; ^ difsub.cpp:6:23: error: 'NMax' was not declared in this scope int info[NMax], n, st[NMax], dr[NMax]; ^ difsub.cpp:6:33: error: 'NMax' was not declared in this scope int info[NMax], n, st[NMax], dr[NMax]; ^ difsub.cpp: In function 'void citire()': difsub.cpp:10:14: error: 'info' was not declared in this scope fin>>info[i]>>st[i]>>dr[i]; ^ difsub.cpp:10:23: error: 'st' was not declared in this scope fin>>info[i]>>st[i]>>dr[i]; ^ difsub.cpp:10:30: error: 'dr' was not declared in this scope fin>>info[i]>>st[i]>>dr[i]; ^ difsub.cpp: In function 'int rad()': difsub.cpp:13:11: error: 'NMax' was not declared in this scope int v[NMax]; ^ difsub.cpp:15:9: error: 'v' was not declared in this scope v[i]=0; ^ difsub.cpp:18:12: error: 'st' was not declared in this scope if(st[i]!=0) ^ difsub.cpp:19:13: error: 'v' was not declared in this scope v[st[i]]=1; ^ difsub.cpp:20:12: error: 'dr' was not declared in this scope if(dr[i]!=0) ^ difsub.cpp:21:13: error: 'v' was not declared in this scope v[dr[i]]=1; ^ difsub.cpp:24:12: error: 'v' was not declared in this scope if(v[i]==0) ^ difsub.cpp: In function 'int suma(int)': difsub.cpp:30:16: error: 'info' was not declared in this scope return info[x] + suma(st[x]) + suma(dr[x]); ^ difsub.cpp:30:31: error: 'st' was not declared in this scope return info[x] + suma(st[x]) + suma(dr[x]); ^ difsub.cpp:30:45: error: 'dr' was not declared in this scope return info[x] + suma(st[x]) + suma(dr[x]); ^ difsub.cpp: In function 'int main()': difsub.cpp:37:17: error: 'st' was not declared in this scope int ss=suma(st[r]); ^ difsub.cpp:38:17: error: 'dr' was not declared in this scope int sd=suma(dr[r]); ^ difsub.cpp: In function 'int suma(int)': difsub.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DifSub 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ă.