#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 | #64709003 | Utilizator | |
| Fișier | maxprim.cpp | Dimensiune | 667 B |
| Data încărcării | 25 Mai 2026, 12:51 | Scor/rezultat | Eroare de compilare |
maxprim.cpp: In function ‘int prim(int)’: maxprim.cpp:8:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(i=2; i*i<=x; i++) | ^~~ maxprim.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | return 1; | ^~~~~~ maxprim.cpp: In function ‘int suma(int, int)’: maxprim.cpp:21:9: error: expected ‘}’ before ‘else’ 21 | else return 0; | ^~~~ maxprim.cpp:17:5: note: to match this ‘{’ 17 | { | ^ maxprim.cpp:15:9: warning: unused variable ‘m’ [-Wunused-variable] 15 | int m,s1,s2,s=0; | ^ maxprim.cpp:15:11: warning: unused variable ‘s1’ [-Wunused-variable] 15 | int m,s1,s2,s=0; | ^~ maxprim.cpp:15:14: warning: unused variable ‘s2’ [-Wunused-variable] 15 | int m,s1,s2,s=0; | ^~ maxprim.cpp: At global scope: maxprim.cpp:24:5: error: expected unqualified-id before ‘else’ 24 | else | ^~~~ maxprim.cpp:33:1: error: expected declaration before ‘}’ token 33 | } | ^ maxprim.cpp: In function ‘int main()’: maxprim.cpp:36:13: warning: unused variable ‘p’ [-Wunused-variable] 36 | int n,i,p; | ^
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ă.