#111
Să se scrie un program care citește un șir de n numere naturale şi determină numărul din şir care are număr maxim de factori primi.
| Problema | NrFact | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64764819 | Utilizator | |
| Fișier | nrfact.cpp | Dimensiune | 494 B |
| Data încărcării | 28 Mai 2026, 15:50 | Scor/rezultat | Eroare de compilare |
nrfact.cpp:1:21: warning: extra tokens at end of #include directive 1 | #include <iostream> using namespace std; | ^~~~~ nrfact.cpp: In function ‘int f(int)’: nrfact.cpp:7:13: error: expected ‘)’ before numeric constant 7 | while (x % 2 0) { | ~ ^~ | ) nrfact.cpp:7:15: error: expected ‘;’ before ‘)’ token 7 | while (x % 2 0) { | ^ | ; nrfact.cpp:7:14: warning: statement has no effect [-Wunused-value] 7 | while (x % 2 0) { | ^ nrfact.cpp:15:18: error: expected ‘;’ before ‘d’ 15 | for (int d = 3; d d <= x; d = d + 2) { | ^~ | ; nrfact.cpp:15:21: warning: for increment expression has no effect [-Wunused-value] 15 | for (int d = 3; d d <= x; d = d + 2) { | ~~^~~~ nrfact.cpp:15:25: error: expected ‘)’ before ‘;’ token 15 | for (int d = 3; d d <= x; d = d + 2) { | ~ ^ | ) nrfact.cpp:15:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 15 | for (int d = 3; d d <= x; d = d + 2) { | ^~~ nrfact.cpp:15:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 15 | for (int d = 3; d d <= x; d = d + 2) { | ^ nrfact.cpp:15:27: error: ‘d’ was not declared in this scope nrfact.cpp: In function ‘int main()’: nrfact.cpp:40:1: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 40 | cin >> n; | ^~~ | std::cin In file included from nrfact.cpp:1: /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ nrfact.cpp:50:21: error: unable to find numeric literal operator ‘operator""x’ 50 | if (k>mx||(k== mx * 88x < r )) { | ^~~ nrfact.cpp:50:21: note: use ‘-fext-numeric-literals’ to enable more built-in suffixes nrfact.cpp:52:7: error: expected ‘;’ before ‘r’ 52 | mx = k | ^ | ; 53 | 54 | r = x; | ~ nrfact.cpp:60:1: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 60 | cout << r | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrFact 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ă.