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

建议使用的浏览器:

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

5612:Baby Ming and Matrix games

题目描述
These few days, Baby Ming is addicted to playing a matrix game.

Given a $n*m$ matrix, the character in the matrix$(i*2, j*2) \ (i, j = 0, 1, 2 ...)$ are the numbers between $0-9$. There are an arithmetic sign (‘+’, ‘-‘, ‘$*$’, ‘/’) between every two adjacent numbers, other places in the matrix fill with ‘#’.

The question is whether you can find an expressions from the matrix, in order to make the result of the expressions equal to the given integer $sum$. (Expressions are calculated according to the order from left to right)

Get expressions by the following way: select a number as a starting point, and then selecting an adjacent digital X to make the expressions, and then, selecting the location of X for the next starting point. (The number in same place can’t be used twice.)
输入解释
In the first line contains a single positive integer $T$, indicating number of test case.

In the second line there are two odd numbers $n, m$, and an integer sum($-10^{18} < sum < 10^{18}$, divisor 0 is not legitimate, division rules see example)

In the next $n$ lines, each line input $m$ characters, indicating the matrix. (The number of numbers in the matrix is less than $15$)

$1 \leq T \leq 1000$
输出解释
Print Possible if it is possible to find such an expressions.

Print Impossible if it is impossible to find such an expressions.
输入样例
3
3 3 24
1*1
+#*
2*8
1 1 1
1
3 3 3
1*0
/#*
2*6
输出样例
Possible
Possible
Possible



提示
The first sample:1+2*8=24
The third sample:1/2*6=3
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5612

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

共提交 0

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