Detalii evaluare #50422760

Rezumat problemă

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.

Detalii

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 #50422760 Utilizator Balan Otniel (BalanOtniel)
Fișier countprimsub.cpp Dimensiune 2.53 KB
Data încărcării 09 Aprilie 2024, 09:01 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

countprimsub.cpp:2:10: error: stray '#' in program
 Problema #676 – CountPrimSub – Rezolvari PBInfo

          ^
countprimsub.cpp:2:1: error: stray '\342' in program
 Problema #676 – CountPrimSub – Rezolvari PBInfo

 ^
countprimsub.cpp:2:1: error: stray '\200' in program
countprimsub.cpp:2:1: error: stray '\223' in program
countprimsub.cpp:2:1: error: stray '\342' in program
countprimsub.cpp:2:1: error: stray '\200' in program
countprimsub.cpp:2:1: error: stray '\223' in program
countprimsub.cpp:4:1: error: stray '\310' in program
 Cerința

 ^
countprimsub.cpp:4:1: error: stray '\233' in program
countprimsub.cpp:5:1: error: stray '\304' in program
 Considerăm un arbore binar cu n noduri în care fiecare nod este numerotat de la 1 la n și conține o valoare număr natural. 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.

 ^
countprimsub.cpp:5:1: error: stray '\203' in program
countprimsub.cpp:5:1: error: stray '\303' in program
countprimsub.cpp:5:1: error: stray '\256' in program
countprimsub.cpp:5:1: error: stray '\310' in program
countprimsub.cpp:5:1: error: stray '\231' in program
countprimsub.cpp:5:1: error: stray '\310' in program
countprimsub.cpp:5:1: error: stray '\233' in program
countprimsub.cpp:5:1: error: stray '\304' in program
countprimsub.cpp:5:1: error: stray '\203' in program
countprimsub.cpp:5:1: error: stray '\310' in program
countprimsub.cpp:5:1: error: stray '\231' in program
countprimsub.cpp:5:1: error: stray '\304' in program
countprimsub.cpp:5:1: error: stray '\203' in program
countprimsub.cpp:5:1: error: stray '\304' in program
countprimsub.cpp:5:1: error: stray '\203' in program
countprimsub.cpp:5:1: error: stray '\304' in program
countprimsub.cpp:5:1: error: stray '\203' in program
countprimsub.cpp:5:1: error: stray '\303' in program
countprimsub.cpp:5:1: error: stray '\256' in program
countprimsub.cpp:5:1: error: stray '\310' in program
countprimsub.cpp:5:1: error: stray '\233' in program
countprimsub.cpp:8:1: error: stray '\310' in program
 Fișierul de intrare countprimsub.in conține pe prima linie numărul n. Fiecare dintre următoarele n linii contine câte 3 numere X st dr; linia i + 1 din fișier conține informatiile despre nodul numerotat cu i: X reprezintă valoare din nod, st reprezintă numărul de ordine al descendentului stâng sau 0 dacă nodul i nu are descendent stâng, iar dr reprezintă numărul de ordine al descendentului drept sau 0 dacă nodul i nu are descendent drept.

 ^
countprimsub.cpp:8:1: error: stray '\231' in program
countprimsub.cpp:8:1: error: stray '\310' in program
countprimsub.cpp:8:1: error: stray '\233' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\303' in program
countprimsub.cpp:8:1: error: stray '\242' in program
countprimsub.cpp:8:1: error: stray '\310' in program
countprimsub.cpp:8:1: error: stray '\231' in program
countprimsub.cpp:8:1: error: stray '\310' in program
countprimsub.cpp:8:1: error: stray '\233' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\303' in program
countprimsub.cpp:8:1: error: stray '\242' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\303' in program
countprimsub.cpp:8:1: error: stray '\242' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:8:1: error: stray '\304' in program
countprimsub.cpp:8:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\304' in program
 Pe următoarea linie se află numărul k, iar pe fiecare dintre următoarele k linii se află câte un număr natural cuprins între 1 și n, reprezentând nodul curent.

 ^
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\304' in program
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\304' in program
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\304' in program
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\304' in program
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\303' in program
countprimsub.cpp:10:1: error: stray '\242' in program
countprimsub.cpp:10:1: error: stray '\304' in program
countprimsub.cpp:10:1: error: stray '\203' in program
countprimsub.cpp:10:1: error: stray '\303' in program
countprimsub.cpp:10:1: error: stray '\256' in program
countprimsub.cpp:10:1: error: stray '\310' in program
countprimsub.cpp:10:1: error: stray '\231' in program
countprimsub.cpp:10:1: error: stray '\303' in program
countprimsub.cpp:10:1: error: stray '\242' in program
countprimsub.cpp:12:1: error: stray '\310' in program
 Date de ieșire

 ^
countprimsub.cpp:12:1: error: stray '\231' in program
countprimsub.cpp:13:1: error: stray '\310' in program
 Fișierul de ieșire countprimsub.out va conține k linii; fiecare linie va conține numărul de noduri din subarborele cu rădăcina în nodul corespunzător.

 ^
countprimsub.cpp:13:1: error: stray '\231' in program
countprimsub.cpp:13:1: error: stray '\310' in program
countprimsub.cpp:13:1: error: stray '\231' in program
countprimsub.cpp:13:1: error: stray '\310' in program
countprimsub.cpp:13:1: error: stray '\233' in program
countprimsub.cpp:13:1: error: stray '\310' in program
countprimsub.cpp:13:1: error: stray '\233' in program
countprimsub.cpp:13:1: error: stray '\304' in program
countprimsub.cpp:13:1: error: stray '\203' in program
countprimsub.cpp:13:1: error: stray '\304' in program
countprimsub.cpp:13:1: error: stray '\203' in program
countprimsub.cpp:13:1: error: stray '\304' in program
countprimsub.cpp:13:1: error: stray '\203' in program
countprimsub.cpp:13:1: error: stray '\303' in program
countprimsub.cpp:13:1: error: stray '\256' in program
countprimsub.cpp:13:1: error: stray '\304' in program
countprimsub.cpp:13:1: error: stray '\203' in program
countprimsub.cpp:15:1: error: stray '\310' in program
 Restricții și precizări

 ^
countprimsub.cpp:15:1: error: stray '\233' in program
countprimsub.cpp:15:1: error: stray '\310' in program
countprimsub.cpp:15:1: error: stray '\231' in program
countprimsub.cpp:15:1: error: stray '\304' in program
countprimsub.cpp:15:1: error: stray '\203' in program
countprimsub.cpp:16:1: error: stray '\342' in program
 1 ≤ n ≤ 1000

 ^
countprimsub.cpp:16:1: error: stray '\211' in program
countprimsub.cpp:16:1: error: stray '\244' in program
countprimsub.cpp:16:1: error: stray '\342' in program
countprimsub.cpp:16:1: error: stray '\211' in program
countprimsub.cpp:16:1: error: stray '\244' in program
countprimsub.cpp:17:62: error: too many decimal points in number
 valorile din nodurile arborelui vor fi mai mici sau egale cu 1.000.000

                                                              ^
countprimsub.cpp:18:1: error: stray '\342' in program
 1 ≤ k ≤ 1000

 ^
countprimsub.cpp:18:1: error: stray '\211' in program
countprimsub.cpp:18:1: error: stray '\244' in program
countprimsub.cpp:18:1: error: stray '\342' in program
countprimsub.cpp:18:1: error: stray '\211' in program
countprimsub.cpp:18:1: error: stray '\244' in program
countprimsub.cpp:40:1: error: stray '\310' in program
 Explicație

 ^
countprimsub.cpp:40:1: error: stray '\233' in program
countprimsub.cpp:41:1: error: stray '\303' in program
 Exemplul corespunde arborelui de mai jos, în care au fost marcate cu albastru valorile din noduri, iar cu roșu numerele de ordine ale nodurilor.

 ^
countprimsub.cpp:41:1: error: stray '\256' in program
countprimsub.cpp:41:1: error: stray '\310' in program
countprimsub.cpp:41:1: error: stray '\231' in program
countprimsub.cpp:45:1: error: stray '\304' in program
 Subarborele cu rădăcina în nodul numerotat cu 1 conține valorile 1 2 4, dintre care doar 2 este număr prim.

 ^
countprimsub.cpp:45:1: error: stray '\203' in program
countprimsub.cpp:45:1: error: stray '\304' in program
countprimsub.cpp:45:1: error: stray '\203' in program
countprimsub.cpp:45:1: error: stray '\303' in program
countprimsub.cpp:45:1: error: stray '\256' in program
countprimsub.cpp:45:1: error: stray '\310' in program
countprimsub.cpp:45:1: error: stray '\233' in program
countprimsub.cpp:45:1: error: stray '\304' in program
countprimsub.cpp:45:1: error: stray '\203' in program
countprimsub.cpp:2:1: error: 'Problema' does not name a type
 Problema #676 – CountPrimSub – Rezolvari PBInfo

 ^
countprimsub.cpp:8:142: error: 'linia' does not name a type
 Fișierul de intrare countprimsub.in conține pe prima linie numărul n. Fiecare dintre următoarele n linii contine câte 3 numere X st dr; linia i + 1 din fișier conține informatiile despre nodul numerotat cu i: X reprezintă valoare din nod, st reprezintă numărul de ordine al descendentului stâng sau 0 dacă nodul i nu are descendent stâng, iar dr reprezintă numărul de ordine al descendentului drept sau 0 dacă nodul i nu are descendent drept.

                                                                                                                                              ^
countprimsub.cpp:13:60: error: 'fiecare' does not name a type
 Fișierul de ieșire countprimsub.out va conține k linii; fiecare linie va conține numărul de noduri din subarborele cu rădăcina în nodul corespunzător.

                                                            ^
countprimsub.cpp: In function 'int main()':
countprimsub.cpp:72:5: error: reference to 'cin' is ambiguous
     cin >> n;

     ^
countprimsub.cpp:49:10: note: candidates are: std::ifstream cin
 ifstream cin("countprimsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countprimsub.cpp:47:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countprimsub.cpp:75:9: error: reference to 'cin' is ambiguous
         cin >> val[i] >> St[i] >> Dr[i];

         ^
countprimsub.cpp:49:10: note: candidates are: std::ifstream cin
 ifstream cin("countprimsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countprimsub.cpp:47:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countprimsub.cpp:79:5: error: reference to 'cin' is ambiguous
     cin >> k;

     ^
countprimsub.cpp:49:10: note: candidates are: std::ifstream cin
 ifstream cin("countprimsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countprimsub.cpp:47:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countprimsub.cpp:82:9: error: reference to 'cin' is ambiguous
         cin >> x;

         ^
countprimsub.cpp:49:10: note: candidates are: std::ifstream cin
 ifstream cin("countprimsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countprimsub.cpp:47:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countprimsub.cpp:85:9: error: reference to 'cout' is ambiguous
         cout << cnt << '\n';

         ^
countprimsub.cpp:50:10: note: candidates are: std::ofstream cout
 ofstream cout("countprimsub.out");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countprimsub.cpp:47:
/usr/include/c++/4.8/iostream:61:18: note:                 std::ostream std::cout
   extern ostream cout;  /// Linked to standard output
                  ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema CountPrimSub face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.