#t415. 乘积最大
乘积最大
Maximum Product
Problem Description
The year 2000 was designated as the "World Mathematical Year" by the International Mathematical Union, and it also marks the 90th anniversary of the birth of the famous Chinese mathematician Hua Luogeng. In his hometown Jintan, Jiangsu, a math competition was organized. Your good friend XZ was lucky to participate. The host gave all contestants the following problem:
Given a digit string of length , the contestant must insert multiplication signs to split it into parts, and find a way to maximize the product of these parts.
To help contestants understand, the host gave the following example:
For the digit string , when , there are two ways:
The result satisfying the requirement is .
Now, please help your good friend XZ design a program to find the correct answer.
Input Format
The input has two lines:
The first line contains two natural numbers .
The second line is a digit string of length .
Output Format
Output the maximum product (a natural number) found.
Sample Input 1
4 2
1231
Sample Output 1
62
Constraints
For of the test data, . For all test data, .