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

建议使用的浏览器:

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

2471:History of Languages

题目描述
We are examining two specific classes of languages (a possibly infinite set of
strings) in this problem. Fortunately (or maybe unfortunately), we are not given the strings contained in each language directly, rather we are given two deterministic finite automatons that describe such languages.

Your task here is simple: to determine if the languages described by the two automatons are the same.

输入解释
There are multiple test cases in the input file.
The first line of each test case is one integer, T ( 2 ÷ T ÷ 26), the size of the alphabet. In each test case, the description of automaton A comes before that of automaton B. The description of each automaton starts with one line containing N (1 ÷ N ÷ 2000 ), the number of states in the automaton, followed by N lines, each line of the format: F, X0, X1, ˇ, XT-1, ,-1 ÷ Xi < N). If F = 1, then the state is an accepting state; also, if Xi = -1, it means that the state has no corresponding transition available for character i. The start state of both finite automatons will always be state 0.

Two successive test cases are separated by a blank line. A case with a single 0 indicates the end of the input file, and should not be processed by your program.
输出解释
For each test case, please print “Yes” if the two languages described by the
automatons are equivalent; output “No” otherwise.
输入样例
2
3
1 -1 1
0 -1 2
0 -1 0
2
1 -1 1
0 -1 0
3
4
1 -1 -1 1
1 -1 -1 2
1 -1 -1 3
1 -1 -1 1
2
1 -1 -1 1
1 -1 -1 0
0
输出样例
Case #1: No
Case #2: Yes
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-2471

最后修改于 2020-10-25T22:53:44+00:00 由爬虫自动更新

共提交 0

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