当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3387:Calculator

题目描述
A simple 8-digit electronic calculator contains the following buttons: “1234567890+-*/=” (no quotes). It can be divided into the following categories:
Digit: “1234567890”
You can input any number with digital buttons (ignore leading zero). Notice, the LED of calculator can only display 8 digits. So when the number of digits large than eight, only the first eight digits will be retained. And when the number of one result’s digits large than eight, error occurs.
Operator: “+-*/”
For simplicity, all operations are integer operations. Some continuous operators, the last one is valid. When an operator button is pressed, the calculation before that will be completed.
输入解释
The first line is number of test cases. After that, each case consists of one line, containing a string means pressed button. The length of string is less than 100. There is no additional space.
输出解释
First output the case number. Then output the displayed number in the same line. If there is any error occurs, just print “ERROR” please. Please follow the format of the sample output.
输入样例
6
11+/2+
11+*==
3==+5=
5=7=+8=
99999999+1-1=
1-99999999=
输出样例
Case 1: 5
Case 2: 1331
Case 3: 8
Case 4: 15
Case 5: ERROR
Case 6: -99999998
来自杭电HDUOJ的附加信息
Author xay@whu
Recommend notonlysuccess

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3387

最后修改于 2020-10-25T23:03:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)