#757
BiMax
Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se determine valorile maxime din subarborii stâng și drept ai rădăcinii.
Problema | BiMax | Operații I/O |
bimax.in /bimax.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #34620085 | Utilizator | |
Fișier | bimax.cpp | Dimensiune | 765 B |
Data încărcării | 08 Februarie 2022, 09:30 | Scor / rezultat | Eroare de compilare |
bimax.cpp: In function 'void creare(nod*&)': bimax.cpp:10:9: error: declaration of 'int p' shadows a parameter { int x,p; ^ bimax.cpp:12:15: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null] if(x==0) p=NULL; ^ bimax.cpp:14:6: error: invalid conversion from 'nod*' to 'int' [-fpermissive] { p=new(nod);p->info=x; ^ bimax.cpp:14:17: error: base operand of '->' is not a pointer { p=new(nod);p->info=x; ^ bimax.cpp:16:9: error: base operand of '->' is not a pointer creare(p->st); ^ bimax.cpp:18:9: error: base operand of '->' is not a pointer creare(p->dr); ^ bimax.cpp: In function 'int maxim()': bimax.cpp:22:8: error: 'p' was not declared in this scope if(p==NULL) ^ bimax.cpp:26:21: error: redeclaration of 'int p' int m1,m2,m,p; ^ bimax.cpp:22:8: error: '<typeprefixerror>p' previously declared here if(p==NULL) ^ bimax.cpp:27:19: error: base operand of '->' is not a pointer m1=maxim(p->st); ^ bimax.cpp:28:19: error: base operand of '->' is not a pointer m2=maxim(p->dr); ^ bimax.cpp:31:15: error: base operand of '->' is not a pointer if(m>p->info) return m; ^ bimax.cpp:32:22: error: base operand of '->' is not a pointer else return p->info; ^ bimax.cpp: In function 'int main()': bimax.cpp:41:14: error: 'p' was not declared in this scope g<<maxim(p->st)<<" "<<maxim(p->dr); ^ bimax.cpp:38:5: warning: unused variable 'i' [-Wunused-variable] int i; ^ bimax.cpp: In function 'int maxim()': bimax.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BiMax 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ă.