#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 | #59816952 | Utilizator | |
| Fișier | nrfact.cpp | Dimensiune | 858 B |
| Data încărcării | 09 Octombrie 2025, 20:03 | Scor/rezultat | Eroare de compilare |
nrfact.cpp: In function 'int main()': nrfact.cpp:5:27: error: redeclaration of 'int nrmax' int n, temp, nrmax=1, nrmax = 0; ^ nrfact.cpp:5:18: error: 'int nrmax' previously declared here int n, temp, nrmax=1, nrmax = 0; ^ nrfact.cpp:15:17: error: 'nrfact' was not declared in this scope nrfact++; ^ nrfact.cpp:26:23: error: 'nrmaxim' was not declared in this scope if (nrfact > nrmaxim) ^ nrfact.cpp:27:9: error: expected primary-expression before '}' token } ^ nrfact.cpp:27:9: error: expected ';' before '}' token nrfact.cpp:28:13: error: 'nrmaxim' was not declared in this scope nrmaxim = nrfact; ^ nrfact.cpp:28:23: error: 'nrfact' was not declared in this scope nrmaxim = nrfact; ^ nrfact.cpp:29:13: error: 'maxim' was not declared in this scope maxim = copie; ^ nrfact.cpp:31:9: error: 'else' without a previous 'if' else if (nrfact == nrmaxim) ^ nrfact.cpp:31:18: error: 'nrfact' was not declared in this scope else if (nrfact == nrmaxim) ^ nrfact.cpp:31:28: error: 'nrmaxim' was not declared in this scope else if (nrfact == nrmaxim) ^ nrfact.cpp:32:29: error: 'maxim' was not declared in this scope if (copie < maxim) ^ nrfact.cpp:34:15: error: 'maxim' was not declared in this scope } cout << maxim << endl; ^ nrfact.cpp:5:18: warning: unused variable 'nrmax' [-Wunused-variable] int n, temp, nrmax=1, nrmax = 0; ^
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ă.