Special palindrome number time limit: 1.0s memory limit: 512.0MBProblem Description 123321 is a very special number, it reads from the left and reads from the right are the same.
Enter a positive integer n, programming all such five-bit and six-bit decimal numbers to satisfy the sum of the numbers equal to N. Enter a line in the format that contains a positive integer n. The output format outputs an integer that satisfies the condition in order from small to large, with each integer occupying one row. Example input 52 sample output 899998
989989
998899 Data size and convention 1<=n<=54.
And the same as before.
AC Code:
#include <cstdio> #include <cstring> #include <algorithm>using namespace std;const int maxn = 2000;int PALIN[MAXN], num = 0;int is_palin (int n) //Determine if the palindrome number {if (n<100000) {if (n/10000 = n%10) && (n/1000%10 = = n/ 10%10)) return 1;} Else{if ((n/100000 = = n%10) && (n/10000%10 = = n/10%10) && (n/1000%10 = n/100%10)) return 1;} return 0;} void init () //palindrome number dozen Table {for (int i=10000; i<=999999; i++) {if (Is_palin (i)) palin[num++] = i;}} int fun (int n)
Blue Bridge Cup-special palindrome number