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

建议使用的浏览器:

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

2658:Firebirds' Logic Nation

题目描述
In HDU, there is an little world created by GL, WYB, and CTW. This world lives some birds which are recognized as firebirds. Actually, the firebirds' world exists three kind of birds, respectively created by GL, WYB, CTW. So I will call them "Gbird", "Wbird", "Cbird" below.
What's more, these birds can talk to ACMers and have their own habit as follows:
Gbird are like GL, never tell truth. Wbird like to tell the truth in the day, but lie in the night. While Cbird are all honest, and never lie.
Now, some firebirds talk to you and tell you some statements, can you deduce what kind of these birds are, and whether it's day or night?
输入解释
The input contains several cases. Each description starts with two integer n and m respectively represent the number of birds and statements. Then following m lines each contain one statement. And one statement is begin with "X: ", X is the identity of speaker. Then follows the contents, like following kinds:

I am [not] ( Gbird | Wbird | Cbird | lying ).
X is [not] ( Gbird | Wbird | Cbird | lying ).
It is ( day | night ).

The word in [] may appear or not appear. The word in () mean that exactly one of the words separated by | must appear. X is the identity of birds, it's a uppecase character between 'A' and 'Z'.
0 < n < 27, 0 < m < 100, 'A' <= X <= 'Z'.
Input end with a case n = 0 and m = 0.
输出解释
For each case, first output a line with "Case #x:", x represent the number of case and start with 1. Then print "You're kidding.", if the conversation cannot happen according to the rules or "I messed up.", if no facts can be deduced. Otherwise print all the facts that can be deduced.
输入样例
1 1
A: I am Cbird.
1 1
A: I am lying.
3 4
A: B is Wbird.
B: C is Wbird.
C: A is Wbird.
C: I am Gbird.
0 0
输出样例
Case #1:
I messed up.
Case #2:
You're kidding.
Case #3:
A is a Gbird.
B is a Cbird.
C is a Wbird.
It is night.


提示
 hints:
case 1: You cannot reduce anything from it.
case 2: If A is lying, then it's telling a truth. If it's telling a truth, it's lying. So it cannot happen according to the rules.
case 3: Gbird won't say itself is a Gbird, so C is lying(statement 4 is false). You can reduce that it is night and C is a Wbird.
 So B is telling the truth(statement 2 is true). 
It's a Cbird. A is not a Wbird(statement 3 is false) and is not a Cbird(statement 1 is false). So A is a Wbird.
来自杭电HDUOJ的附加信息
Author CTW
Recommend yifenfei

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

题目来源 决战龙虎门

源链接: HDU-2658

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

共提交 0

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