#2415
nr_pal
Se dau n
întrebări de forma: Câte palindromuri există în intervalul [a,b]
?, unde a
și b
sunt numere naturale date, cu a ≤ b
.
Problema | nr_pal | Operații I/O |
nr_pal.in /nr_pal.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #55037468 | Utilizator | |
Fișier | nr_pal.cpp | Dimensiune | 1.29 KB |
Data încărcării | 17 Decembrie 2024, 19:11 | Scor / rezultat | Eroare de compilare |
nr_pal.cpp: In function 'int nrpal(int)': nr_pal.cpp:34:8: error: assignment of function 'int ogl(int)' ogl=1; ^ nr_pal.cpp:34:8: error: cannot convert 'int' to 'int(int)' in assignment nr_pal.cpp:37:12: warning: pointer to a function used in arithmetic [-Wpointer-arith] ogl+=2*(putere(10,cif/2)-1); ^ nr_pal.cpp:37:12: error: assignment of function 'int ogl(int)' nr_pal.cpp:37:12: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:39:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(n>=pal) ogl+=n/putere(10,cif/2)-putere(10,cif/2)+1; ^ nr_pal.cpp:39:23: error: assignment of function 'int ogl(int)' nr_pal.cpp:39:23: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:40:17: warning: pointer to a function used in arithmetic [-Wpointer-arith] else ogl+=n/putere(10,cif/2)-putere(10,cif/2); ^ nr_pal.cpp:40:17: error: assignment of function 'int ogl(int)' nr_pal.cpp:40:17: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:44:12: warning: pointer to a function used in arithmetic [-Wpointer-arith] ogl+=2*(putere(10,(cif-1)/2)-1)+9*putere(10,(cif-1)/2); ^ nr_pal.cpp:44:12: error: assignment of function 'int ogl(int)' nr_pal.cpp:44:12: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:46:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(n>=pal) ogl+=n/putere(10,cif/2)-putere(10,cif/2-1)+1; ^ nr_pal.cpp:46:23: error: assignment of function 'int ogl(int)' nr_pal.cpp:46:23: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:47:17: warning: pointer to a function used in arithmetic [-Wpointer-arith] else ogl+=n/putere(10,cif/2)-putere(10,cif/2-1); ^ nr_pal.cpp:47:17: error: assignment of function 'int ogl(int)' nr_pal.cpp:47:17: error: cannot convert 'int (*)(int)' to 'int(int)' in assignment nr_pal.cpp:49:12: error: invalid conversion from 'int (*)(int)' to 'int' [-fpermissive] return ogl; ^ nr_pal.cpp: In function 'int main()': nr_pal.cpp:61:31: error: 'nr_pal' was not declared in this scope printf("%d\n",nr_pal(b)-nr_pal(a-1) ); ^ nr_pal.cpp:54:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("nr_pal.in","r",stdin); ^ nr_pal.cpp:55:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("nr_pal.out","w",stdout); ^ nr_pal.cpp:56:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ nr_pal.cpp:60:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d",&a,&b); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema nr_pal 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ă.