#K6956. Largest Palindromic Product
Largest Palindromic Product
Largest Palindromic Product
Given a positive integer n, your task is to compute the largest palindromic number that can be obtained as a product of two n-digit numbers. A number is palindromic if it remains the same when its digits are reversed. In other words, if we define a palindrome as a number P such that \( P = \text{reverse}(P) \), then you need to find the maximum value of \( P = i \times j \), where \( i \) and \( j \) are both n-digit numbers (i.e. \( 10^{n-1} \leq i, j \leq 10^n - 1 \)).
Note: Due to the potential size of the search space, the constraints on n are expected to be small (for instance, n up to 4) so that a brute-force approach is feasible.
inputFormat
The input consists of a single integer n read from standard input, representing the number of digits for both factors.
outputFormat
Output a single integer which is the largest palindromic number obtained from the product of two n-digit numbers. The output should be written to standard output.
## sample1
9
</p>