CF58E.Expression
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One day Vasya was solving arithmetical problems. He wrote down an expression a + b = c in his notebook. When the teacher checked Vasya's work it turned out that Vasya had solved the problem incorrectly. Now Vasya tries to find excuses. He says that he simply forgot to write down several digits in numbers a, b and c, but he can't remember what numbers they actually were. Help Vasya, find such numbers x, y and z, with which the following conditions are met:
- x + y = z,
- from the expression x + y = z several digits can be erased in such a way that the result will be a + b = c,
- the expression x + y = z should have the minimal length.
一天,瓦西娅正在解算术题。他在笔记本上写下了表达式 a+b=c。当老师检查瓦西娅的作业时,发现他解错了。现在瓦西娅正试图找借口,声称自己只是在数字 a、b 和 c 中遗漏书写了若干位数字,但他已记不清这些数字原本是什么了。请帮助瓦西娅找出满足以下条件的数字 x、y 和 z:
- x+y=z;
- 从表达式 x+y=z 中删去若干位数字(可删去任意位置的若干数字,但不能改变剩余数字的相对顺序),可以得到 a+b=c;
- 表达式 x+y=z 的总长度(即 x、y、z 的十进制表示拼接后不含加号与等号的总字符数)应尽可能小。
输入格式
The first and only input line contains the expression a + b = c (1 ≤ a, b, c ≤ 106, a, b and c don't contain leading zeroes) which is the expression Vasya wrote down.
第一行且唯一一行输入包含表达式 a+b=c(其中 1≤a,b,c≤106,且 a、b、c 均不包含前导零),该表达式是瓦夏写下的。
输出格式
Print the correct expression x + y = z (x, y and z are non-negative numbers without leading zeroes). The expression a + b = c must be met in x + y = z as a subsequence. The printed solution should have the minimal possible number of characters. If there are several such solutions, you can print any of them.
输出正确的表达式 x+y=z(其中 x、y 和 z 是无前导零的非负整数)。该表达式 a+b=c 必须作为子序列出现在 x+y=z 中。所输出的解应具有最少的字符数。若存在多个满足条件的解,输出任意一个即可。
输入输出样例
输入#1
2+4=5
输出#1
21+4=25
输入#2
1+1=3
输出#2
1+31=32
输入#3
1+1=2
输出#3
1+1=2
输入解题思路,AI测评打分。不知道怎么写?