Răspuns :
DACA ITI DA 100 PCT, COROANA TE ROG!!!
#include <fstream>
using namespace std;
ifstream fin("palindrom2.in");
ofstream fout("palindrom2.out");
int main() {
int c, n, i, j, k, d = 1, nrap = 0, nrpal = 0;
long long x, y, z = 0, a, b;
fin >> c;
fin >> n;
for(i = 1; i <= n; i++) {
fin >> x;
y = x;
z = k = 0;
while (y) {
z = z * 10 + y % 10;
k++;
y /= 10;
}
if(c == 1) {
if(x == z) nrpal++;
}
else
if(c == 2) {
a = x, b = z, d = 0;
while(a && d <= 2) {
if(a % 10 != b % 10) d++;
a /= 10;
b /= 10;
}
if(d == 2) nrap++;
}
else {
int m = 1, prim, ultim;
for(j = 1; j <= k/2; j++)
m *= 10;
y = x / m * m + z % m;
if(y <= x) {
if(k % 2 == 0) a = b = (x / m + 1);
else a = b = (x / m + 1)/10;
z = 0;
while(b) {
z = z * 10 + b % 10;
b = b / 10;
}
y=(x / m + 1)* m + z;
}
fout << y << " ";
}
}
if(c == 1) fout << nrpal;
else if(c == 2) fout << nrap;
return 0;
}