#1149
Se dă un şir cu n elemente, numere naturale. Folosind metoda Divide et Impera să se verifice dacă în șir există elemente prime.
| Problema | ExistaPrimeDivImp | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64814330 | Utilizator | |
| Fișier | existaprimedivimp.cpp | Dimensiune | 558 B |
| Data încărcării | 03 Iunie 2026, 09:12 | Scor/rezultat | Eroare de compilare |
existaprimedivimp.cpp: In function ‘int prim(int, int)’: existaprimedivimp.cpp:6:9: error: ‘retrun’ was not declared in this scope 6 | retrun 0; | ^~~~~~ existaprimedivimp.cpp:8:12: error: expected primary-expression before ‘)’ token 8 | if() | ^ existaprimedivimp.cpp:9:1: error: expected primary-expression before ‘}’ token 9 | } | ^ existaprimedivimp.cpp:9:1: warning: no return statement in function returning non-void [-Wreturn-type] existaprimedivimp.cpp: In function ‘int DEI(int*, int, int, int)’: existaprimedivimp.cpp:13:16: error: too few arguments to function ‘int prim(int, int)’ 13 | if(prim(a[li])==1) return 1; | ~~~~^~~~~~~ existaprimedivimp.cpp:3:5: note: declared here 3 | int prim(int x, int d) | ^~~~ existaprimedivimp.cpp:17:13: warning: unused variable ‘R1’ [-Wunused-variable] 17 | int R1,R2; | ^~ existaprimedivimp.cpp:17:16: warning: unused variable ‘R2’ [-Wunused-variable] 17 | int R1,R2; | ^~ existaprimedivimp.cpp: In function ‘int main()’: existaprimedivimp.cpp:29:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=] 29 | scanf("%d", DEI(v,n,1,n)); | ~^ ~~~~~~~~~~~~ | | | | int* int existaprimedivimp.cpp: In function ‘int DEI(int*, int, int, int)’: existaprimedivimp.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type] 24 | } | ^ existaprimedivimp.cpp: In function ‘int main()’: existaprimedivimp.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ existaprimedivimp.cpp:29:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | scanf("%d", DEI(v,n,1,n)); | ~~~~~^~~~~~~~~~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ExistaPrimeDivImp 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ă.