#abc363f. F - Palindromic Expression
F - Palindromic Expression
Score : points
问题陈述
给定一个整数 。打印一个满足以下所有条件的字符串 。如果不存在这样的字符串,请打印 -1
。
- 是一个长度在 到 之间(包括两端)的字符串,由字符
1
,2
,3
,4
,5
,6
,7
,8
,9
和*
(乘法符号)组成。 - 是一个回文。
- 的第一个字符是一个数字。
- 将 作为公式计算时,其值等于 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given an integer . Print a string that satisfies all of the following conditions. If no such string exists, print -1
.
- is a string of length between and , inclusive, consisting of the characters
1
,2
,3
,4
,5
,6
,7
,8
,9
, and*
(multiplication symbol). - is a palindrome.
- The first character of is a digit.
- The value of when evaluated as a formula equals .
Constraints
- is an integer.
Input
The input is given from Standard Input in the following format:
Output
If there is a string that satisfies the conditions exists, print such a string. Otherwise, print -1
.
Sample Input 1
363
Sample Output 1
11*3*11
11*3*11
satisfies the conditions in the problem statement. Another string that satisfies the conditions is 363
.
Sample Input 2
101
Sample Output 2
-1
Note that must not contain the digit 0
.
Sample Input 3
3154625100
Sample Output 3
2*57*184481*75*2