#645
Se dă vectorul de tați al unui arbore cu rădăcină cu n noduri în care fiecare nod are asociată o valoare numerică. Determinați drumul de la rădăcină la un nod terminal pentru care suma valorilor asociate nodurilor este maximă.
| Problema | DetDrum3 | Operații I/O |
detdrum3.in/detdrum3.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64728064 | Utilizator | |
| Fișier | detdrum3.cpp | Dimensiune | 806 B |
| Data încărcării | 26 Mai 2026, 12:43 | Scor/rezultat | 0 puncte |
detdrum3.cpp: In function ‘bool terminal(int)’: detdrum3.cpp:24:17: warning: left operand of comma operator has no effect [-Wunused-value] 24 | for(int i=1;i,+n;i++) | ^ detdrum3.cpp: In function ‘int main()’: detdrum3.cpp:32:13: warning: left operand of comma operator has no effect [-Wunused-value] 32 | for(int i=1;i,+n;i++) | ^ detdrum3.cpp:34:13: warning: left operand of comma operator has no effect [-Wunused-value] 34 | for(int i=1;i,+n;i++) | ^ detdrum3.cpp:34:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 34 | for(int i=1;i,+n;i++) | ^~~ detdrum3.cpp:36:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 36 | int cmax=0,vmax; | ^~~ detdrum3.cpp:37:17: warning: left operand of comma operator has no effect [-Wunused-value] 37 | for(int i=1;i,+n;i++) | ^ In function ‘void drum(int)’, inlined from ‘int main()’ at detdrum3.cpp:45:9: detdrum3.cpp:9:5: warning: ‘vmax’ is used uninitialized [-Wuninitialized] 9 | if(k!=0) | ^~ detdrum3.cpp: In function ‘int main()’: detdrum3.cpp:36:16: note: ‘vmax’ was declared here 36 | int cmax=0,vmax; | ^~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | Depășit | Limita de timp depășită | 20 | 0 | Exemplu | |
| 2 | Depășit | Limita de timp depășită | 40 | 0 | ||
| 3 | Depășit | Limita de timp depășită | 40 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DetDrum3 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ă.