#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 | #64883375 | Utilizator | |
| Fișier | palindrom_prim_norocoase.cpp | Dimensiune | 872 B |
| Data încărcării | 09 Iunie 2026, 12:46 | Scor/rezultat | Eroare de compilare |
palindrom_prim_norocoase.cpp: In function ‘int main()’: palindrom_prim_norocoase.cpp:21:9: error: redeclaration of ‘int x’ 21 | int x; | ^ palindrom_prim_norocoase.cpp:6:9: note: ‘int x’ previously declared here 6 | int x; | ^ palindrom_prim_norocoase.cpp:26:27: error: ‘n’ was not declared in this scope 26 | for(int d=2; d*d<=n,d++) | ^ palindrom_prim_norocoase.cpp:26:32: error: expected ‘;’ before ‘)’ token 26 | for(int d=2; d*d<=n,d++) | ^ | ; palindrom_prim_norocoase.cpp:28:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 28 | if(x%d==0) | ^~ palindrom_prim_norocoase.cpp:31:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 31 | return 1; | ^~~~~~ palindrom_prim_norocoase.cpp:34:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 34 | int main() | ^~ palindrom_prim_norocoase.cpp:34:17: note: remove parentheses to default-initialize a variable 34 | int main() | ^~ | -- palindrom_prim_norocoase.cpp:34:17: note: or replace parentheses with braces to value-initialize a variable palindrom_prim_norocoase.cpp:35:9: error: a function-definition is not allowed here before ‘{’ token 35 | { | ^ palindrom_prim_norocoase.cpp:49:2: error: expected ‘}’ at end of input 49 | } | ^ palindrom_prim_norocoase.cpp:22:5: note: to match this ‘{’ 22 | { | ^ palindrom_prim_norocoase.cpp:49:2: error: expected ‘}’ at end of input 49 | } | ^ palindrom_prim_norocoase.cpp:4:1: note: to match this ‘{’ 4 | { | ^ palindrom_prim_norocoase.cpp:5:9: warning: unused variable ‘palindrom’ [-Wunused-variable] 5 | int palindrom; | ^~~~~~~~~ palindrom_prim_norocoase.cpp:20:9: warning: unused variable ‘prim’ [-Wunused-variable] 20 | 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ă.