int main(void) { const long int MAX_DIGITS = 1000000; char s[MAX_DIGITS+1]; long int t, j; long long int i; #ifdef DEBUG for (i=0; i<1000000; i++) { long long int correct_next_pal = next_pal(i); sprintf(s, "%lld", i); long long int my_next_pal = atol(next_palindrome(s)); if (correct_next_pal != my_next_pal) printf("for input=%lld, correct_next_pal=%lld, my_next_pal=%lld\n", i, correct_next_pal, my_next_pal); } #endif scanf("%ld", &t); while (t-- > 0) { scanf("\n%1000000s", s); printf("%s\n", next_palindrome(s)); } return 0; }
int main() { std::vector<int> number { 1, 2, 3, 4, 5, 6, 9, 5, 4, 3, 1, 9, 6, 4, 3, 7 } ; number.resize(60,9) ; for( int d : number ) std::cout << d ; std::cout << '\n' ; for( int d : next_palindrome(number) ) std::cout << d ; std::cout << '\n' ; }
int main() { int i, t; scanf("%d\n", &t); while (t-- > 0) { next_palindrome(); } return 0; }