CF175A.Robot Bicorn Attack
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasya plays Robot Bicorn Attack.
The game consists of three rounds. For each one a non-negative integer amount of points is given. The result of the game is the sum of obtained points. Vasya has already played three rounds and wrote obtained points one by one (without leading zeros) into the string s. Vasya decided to brag about his achievement to the friends. However, he has forgotten how many points he got for each round. The only thing he remembers is the string s.
Help Vasya to find out what is the maximum amount of points he could get. Take into account that Vasya played Robot Bicorn Attack for the first time, so he could not get more than 1000000 (106) points for one round.
瓦西娅正在玩《机器人双角兽进攻》游戏。
游戏共分为三轮。每轮获得一个非负整数分数。游戏总得分为三轮得分之和。瓦西娅已经完成了三轮游戏,并将每轮所得分数(不含前导零)依次写入字符串 s 中。瓦西娅想向朋友们炫耀自己的成绩,但他已忘记每轮具体得了多少分,唯一记得的只有字符串 s。
请帮助瓦西娅计算他可能获得的最高总分。注意:瓦西娅是第一次玩《机器人双角兽进攻》,因此每轮得分均不超过 1000000(即 106)。
输入格式
The only line of input contains non-empty string s obtained by Vasya. The string consists of digits only. The string length does not exceed 30 characters.
输入仅包含一行,为瓦夏得到的非空字符串 s。该字符串仅由数字组成,且字符串长度不超过 30 个字符。
输出格式
Print the only number — the maximum amount of points Vasya could get. If Vasya is wrong and the string could not be obtained according to the rules then output number -1.
输出唯一一个数字——Vasya 可能得到的最高分数。如果 Vasya 错误,即该字符串无法按照规则得到,则输出数字 -1。
输入输出样例
输入#1
1234
输出#1
37
输入#2
9000
输出#2
90
输入#3
0009
输出#3
-1
说明/提示
In the first example the string must be split into numbers 1, 2 and 34.
In the second example the string must be split into numbers 90, 0 and 0.
In the third example the string is incorrect, because after splitting the string into 3 numbers number 00 or 09 will be obtained, but numbers cannot have leading zeroes.
在第一个例子中,字符串必须被分割为数字 1、2 和 34。
在第二个例子中,字符串必须被分割为数字 90、0 和 0。
在第三个例子中,字符串是不合法的,因为将字符串分割为 3 个数字后,会得到形如 00 或 09 的数字,而数字不能有前导零。
输入解题思路,AI测评打分。不知道怎么写?