#1020
Se consideră un șir cu n elemente, numere naturale. Folosind metoda Divide et Impera, determinați cel mai mare element prim din acest șir.
| Problema | MaxPrim | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64193931 | Utilizator | |
| Fișier | maxprim.cpp | Dimensiune | 674 B |
| Data încărcării | 22 Aprilie 2026, 12:22 | Scor/rezultat | 100 puncte |
maxprim.cpp: In function ‘int prim(int)’: maxprim.cpp:12:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 12 | {if(n<2) | ^~ maxprim.cpp:14:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 14 | for(int i=2;i*i<=n;i++) | ^~~ maxprim.cpp:14:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] maxprim.cpp:17:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 17 | return 1; | ^~~~~~ maxprim.cpp: In function ‘int suma(int, int)’: maxprim.cpp:21:9: warning: unused variable ‘n’ [-Wunused-variable] 21 | int n,s1,s2,m; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 40 | 40 | ||
| 3 | 0.001 secunde | OK. | 40 | 40 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MaxPrim 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ă.