解题思路:暴力破解,直接从1递归,判断其是否符合条件
注意事项:
参考代码:
#include <stdio.h> long fun(long x) { long sum = 95859 + 2 * x; char a[50]; char *p, *e; p = a; sprintf(p, "%ld", sum); e = a; while (*e != '\0') e++; e--; while (p != e) { if (*p != *e) { return fun(x + 1); } p++, e--; } return sum; } int main() { long x = 1; printf("%ld", fun(x)); return 0; }
0.0分
0 人评分