#642
DetDrum
Se dă vectorul de tați al unui arbore cu rădăcină cu n
noduri și un nod k
. Determinați drumul de la nodul k
la rădăcina arborelui.
Problema | DetDrum | Operații I/O |
![]() detdrum.in /detdrum.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57892543 | Utilizator | |
Fișier | detdrum.cpp | Dimensiune | 676 B |
Data încărcării | 29 Aprilie 2025, 14:50 | Scor / rezultat | Eroare de compilare |
detdrum.cpp:6:1: error: expected ',' or ';' before 'int' int t[101],n,r,niv[101],nod,nivmax,k; ^ detdrum.cpp: In function 'void citire()': detdrum.cpp:10:8: error: 'n' was not declared in this scope f>>n>>k; ^ detdrum.cpp:10:11: error: 'k' was not declared in this scope f>>n>>k; ^ detdrum.cpp:13:12: error: 't' was not declared in this scope f>>t[i]; ^ detdrum.cpp:15:13: error: 'r' was not declared in this scope r=i; ^ detdrum.cpp: In function 'void DF(int)': detdrum.cpp:21:20: error: 'n' was not declared in this scope for(int y=1;y<=n;y++) ^ detdrum.cpp:22:12: error: 't' was not declared in this scope if(t[y]==x) ^ detdrum.cpp:24:9: error: 'niv' was not declared in this scope niv[y]=niv[x]+1; ^ detdrum.cpp:25:19: error: 'nivmax' was not declared in this scope if(niv[y]>nivmax) ^ detdrum.cpp:28:13: error: 'nod' was not declared in this scope nod=y; ^ detdrum.cpp: In function 'void drum(int)': detdrum.cpp:36:8: error: 't' was not declared in this scope if(t[x]!=0) ^ detdrum.cpp:38:5: error: 't' was not declared in this scope t[t[nod]]=nod; ^ detdrum.cpp:38:9: error: 'nod' was not declared in this scope t[t[nod]]=nod; ^ detdrum.cpp: In function 'int main()': detdrum.cpp:43:10: error: 'k' was not declared in this scope drum(k); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DetDrum 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ă.