avatar
请教一道算法题# JobHunting - 待字闺中
x*0
1
A spreadsheet consists of a two-dimensional array of cells, labeled A1, A2,
etc. Rows are identified using letters, columns by numbers. Each cell
contains either an integer (its value) or an expression. Expressions contain
integers, cell references, and other operators '+', '-', '*', '/' with the
usual rules of evaluation -- note that the input is RPN and should be
evaluated in stack order.
The spreadsheet input is defined as follows:
(a) Line 1: two integers, defining the width and height of the spreadsheet (
n, m)
(b) n*m lines each containing an expression which is the value of the
corresponding cell (cells enumerated in the order A1, A2, A, B1, ...)
For example:
Input
3 2
A2
4 5 *
A1
A1 B2 / 2 +
3
39 B1 B2 * /
Output
3 2
20.0
20.0
20.0
8.7
3.0
1.5
The above example input visually looks like:
|1 |2 |3 |
--------------------------------------------------
A |A2 |4 5 * |A1 |
--------------------------------------------------
B |A1 B2 / 2 + |3 |39 B1 B2 * / |
--------------------------------------------------
avatar
s*c
2
topSort+RPN?
avatar
l*s
3
Input不能理解,为什么下面的不是B3然后39 B1 B2 * /作为输入值?
3
39 B1 B2 * /
avatar
x*0
4
Input
3 2
A2
4 5 *
A1
A1 B2 / 2 +
3
39 B1 B2 * /
3 => 表示 B2 这个地方 放的是 3
39 B1 B2 * / => B3 这个地方 放的是 39 B1 B2 * /
最开始的输入
3 2 ==》 表示一个3x2的矩阵:X
X[A][1], X[A][2], X[A][3]
X[B][1], X[B][2], X[B][3]
希望对你理解题意有帮组。

【在 l******s 的大作中提到】
: Input不能理解,为什么下面的不是B3然后39 B1 B2 * /作为输入值?
: 3
: 39 B1 B2 * /

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。