#4871
Se dă un șir de n numere naturale. Pentru fiecare din numerele din șir trebuie să afișați următorul număr natural, strict mai mare, care este prim.
| Problema | NextPrime | Operații I/O |
nextprime.in/nextprime.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #60019549 | Utilizator | |
| Fișier | nextprime.cpp | Dimensiune | 421 B |
| Data încărcării | 15 Octombrie 2025, 16:52 | Scor/rezultat | Eroare de compilare |
nextprime.cpp:6:1: error: expected ',' or ';' before 'ofstream' ofstream malakai("nextprime.out") ^ nextprime.cpp: In function 'int nextprim(int)': nextprime.cpp:17:5: error: expected ';' before 'while' while(prim(x)==0); ^ nextprime.cpp:18:12: error: expected 'while' before 'x' return x; ^ nextprime.cpp:18:12: error: expected '(' before 'x' nextprime.cpp:18:13: error: expected ')' before ';' token return x; ^ nextprime.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ nextprime.cpp: In function 'int main()': nextprime.cpp:24:12: error: expected unqualified-id before ')' token for(int) ^ nextprime.cpp:24:12: error: expected ';' before ')' token nextprime.cpp:24:12: error: expected primary-expression before ')' token nextprime.cpp:24:12: error: expected ';' before ')' token nextprime.cpp:25:5: error: expected primary-expression before '...' token ... ^ nextprime.cpp:25:5: error: expected ';' before '...' token nextprime.cpp:22:11: warning: unused variable 'x' [-Wunused-variable] int n,x; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NextPrime 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ă.