#676
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 care conțin valori prime.
Notă: pentru reprezentarea arborelui se recomandă alocarea statică, folosind tablouri.
| Problema | CountPrimSub | Operații I/O |
countprimsub.in/countprimsub.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64760734 | Utilizator | |
| Fișier | countprimsub.cpp | Dimensiune | 2.05 KB |
| Data încărcării | 28 Mai 2026, 12:13 | Scor/rezultat | Eroare de compilare |
countprimsub.cpp:63:2: error: stray ‘#’ in program 63 | }#include <iostream> | ^ countprimsub.cpp:63:3: error: ‘include’ does not name a type 63 | }#include <iostream> | ^~~~~~~ countprimsub.cpp:67:10: error: redefinition of ‘std::ifstream fin’ 67 | ifstream fin("countprimsub.in"); | ^~~ countprimsub.cpp:5:10: note: ‘std::ifstream fin’ previously declared here 5 | ifstream fin("countprimsub.in"); | ^~~ countprimsub.cpp:68:10: error: redefinition of ‘std::ofstream fout’ 68 | ofstream fout("countprimsub.out"); | ^~~~ countprimsub.cpp:6:10: note: ‘std::ofstream fout’ previously declared here 6 | ofstream fout("countprimsub.out"); | ^~~~ countprimsub.cpp:69:5: error: redefinition of ‘int n’ 69 | int n, info[NN], st[NN], dr[NN]; | ^ countprimsub.cpp:7:5: note: ‘int n’ previously declared here 7 | int n, info[NN], st[NN], dr[NN]; | ^ countprimsub.cpp:69:8: error: redefinition of ‘int info [1005]’ 69 | int n, info[NN], st[NN], dr[NN]; | ^~~~ countprimsub.cpp:7:8: note: ‘int info [1005]’ previously declared here 7 | int n, info[NN], st[NN], dr[NN]; | ^~~~ countprimsub.cpp:69:18: error: redefinition of ‘int st [1005]’ 69 | int n, info[NN], st[NN], dr[NN]; | ^~ countprimsub.cpp:7:18: note: ‘int st [1005]’ previously declared here 7 | int n, info[NN], st[NN], dr[NN]; | ^~ countprimsub.cpp:69:26: error: redefinition of ‘int dr [1005]’ 69 | int n, info[NN], st[NN], dr[NN]; | ^~ countprimsub.cpp:7:26: note: ‘int dr [1005]’ previously declared here 7 | int n, info[NN], st[NN], dr[NN]; | ^~ countprimsub.cpp:70:6: error: redefinition of ‘void citire()’ 70 | void citire() | ^~~~~~ countprimsub.cpp:8:6: note: ‘void citire()’ previously defined here 8 | void citire() | ^~~~~~ countprimsub.cpp:76:5: error: redefinition of ‘int radacina()’ 76 | int radacina() | ^~~~~~~~ countprimsub.cpp:14:5: note: ‘int radacina()’ previously defined here 14 | int radacina() | ^~~~~~~~ countprimsub.cpp:93:6: error: redefinition of ‘bool prim(int)’ 93 | bool prim(int n) | ^~~~ countprimsub.cpp:31:6: note: ‘bool prim(int)’ previously defined here 31 | bool prim(int n) | ^~~~ countprimsub.cpp:104:5: error: redefinition of ‘int count(int)’ 104 | int count(int x) | ^~~~~ countprimsub.cpp:42:5: note: ‘int count(int)’ previously defined here 42 | int count(int x) | ^~~~~ countprimsub.cpp:114:5: error: redefinition of ‘int main()’ 114 | int main() | ^~~~ countprimsub.cpp:52:5: note: ‘int main()’ previously defined here 52 | int main() | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CountPrimSub 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ă.