#abc221c. C - Select Mul
C - Select Mul
Score : points
问题描述
给定一个整数 。考虑将 的各位数字进行排列,并将其分割成两个 正整数。
例如,对于整数 ,有六种分割方式如下:
- 和 ,
- 和 ,
- 和 ,
- 和 ,
- 和 ,
- 和 。
这里,分割后的两个整数中不能包含前导零。例如,不允许将整数 分割为 和 。另外,由于得到的两个整数必须为正数,也不允许将 分割为 和 。
通过最优分割方式能得到的最大可能的两个结果整数之积是多少?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given an integer . Consider permuting the digits in and separate them into two positive integers.
For example, for the integer , there are six ways to separate it, as follows:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
Here, the two integers after separation must not contain leading zeros. For example, it is not allowed to separate the integer into and . Additionally, since the resulting integers must be positive, it is not allowed to separate into and , either.
What is the maximum possible product of the two resulting integers, obtained by the optimal separation?
Constraints
- is an integer between and (inclusive).
- contains two or more digits that are not .
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible product of the two integers after separation.
Sample Input 1
123
Sample Output 1
63
As described in Problem Statement, there are six ways to separate it:
- and ,
- and ,
- and ,
- and ,
- and ,
- and .
The products of these pairs, in this order, are , , , , , , with being the maximum.
Sample Input 2
1010
Sample Output 2
100
There are two ways to separate it:
- and ,
- and .
In either case, the product is .
Sample Input 3
998244353
Sample Output 3
939337176
update @ 2024/3/10 09:44:55