#1669
Se dau n numere naturale. Aflaţi câte dintre ele sunt palindrom prim norocoase. Un număr este palindrom prim norocos dacă este palindrom (egal cu răsturnatul său, de exemplu 121), prim (are exact 2 divizori, de exemplu 3) şi norocos (pătratul numărului se poate scrie ca sumă de numere consecutive, exemplu 3. 3 * 3 = 9 = 2 + 3 + 4).
| Problema | palindrom_prim_norocoase | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64883402 | Utilizator | |
| Fișier | palindrom_prim_norocoase.cpp | Dimensiune | 867 B |
| Data încărcării | 09 Iunie 2026, 12:47 | Scor/rezultat | Eroare de compilare |
palindrom_prim_norocoase.cpp: In function ‘int main()’: palindrom_prim_norocoase.cpp:7:19: error: ‘x’ was not declared in this scope 7 | int copie=x, ogl=0; | ^ palindrom_prim_norocoase.cpp:11:9: error: ‘ogl’ was not declared in this scope 11 | ogl=ogl*10+copie%10; | ^~~ palindrom_prim_norocoase.cpp:14:17: error: ‘ogl’ was not declared in this scope 14 | if(x == ogl) | ^~~ palindrom_prim_norocoase.cpp:25:27: error: ‘n’ was not declared in this scope 25 | for(int d=2; d*d<=n,d++) | ^ palindrom_prim_norocoase.cpp:25:32: error: expected ‘;’ before ‘)’ token 25 | for(int d=2; d*d<=n,d++) | ^ | ; palindrom_prim_norocoase.cpp:27:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 27 | if(x%d==0) | ^~ palindrom_prim_norocoase.cpp:30:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 30 | return 1; | ^~~~~~ palindrom_prim_norocoase.cpp:33:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 33 | int main() | ^~ palindrom_prim_norocoase.cpp:33:17: note: remove parentheses to default-initialize a variable 33 | int main() | ^~ | -- palindrom_prim_norocoase.cpp:33:17: note: or replace parentheses with braces to value-initialize a variable palindrom_prim_norocoase.cpp:34:9: error: a function-definition is not allowed here before ‘{’ token 34 | { | ^ palindrom_prim_norocoase.cpp:48:2: error: expected ‘}’ at end of input 48 | } | ^ palindrom_prim_norocoase.cpp:21:5: note: to match this ‘{’ 21 | { | ^ palindrom_prim_norocoase.cpp:48:2: error: expected ‘}’ at end of input 48 | } | ^ palindrom_prim_norocoase.cpp:4:1: note: to match this ‘{’ 4 | { | ^ palindrom_prim_norocoase.cpp:19:9: warning: unused variable ‘prim’ [-Wunused-variable] 19 | int prim; | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema palindrom_prim_norocoase 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ă.