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

建议使用的浏览器:

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

2543:Spreadsheet

题目描述
You are to write a program emulating a very simple spreadsheet application. It works with a table with 9 rows, from "1" to "9", and 26 columns, from "A" to "Z". Table cells are referenced by names composed of column and row codes, ex. "B1", "S8".

Each cell contains an expression up to 255 characters long. Expressions use integer constants, cell references, parenthesis, operators "+", "-", "*", and "/" (whole division). For example: 567, E8/2, (3+B3)*(C4-1) are all valid expressions. All operators are whole, all arguments and results are guaranteed to be less than 1000000. Division by zero yields zero.

If the value of the cell referenced by some expression is not defined, it is presumed to be 0 (zero). The situation when two or more cells are mutually dependent on each other is considered a special case of "circular reference".
输入解释
First input line contains number of expressions N. Following N lines are in format < Cell reference>=< expression>. All expressions are correct, and each cell is defined by at most one expression.
输出解释
Output file must contain single line with either the value of the cell "A1" or number 1000000 (one million) if the value of A1 cannot be computed due to a circular reference.
输入样例
4
A1=B1+C5
B1=20
C5 =B1 /D7-E1*E1
E1=(3+1)*2
输出样例
-44

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2543

最后修改于 2020-10-29T06:35:22+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536