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

建议使用的浏览器:

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

3860:Fruit Weights

题目描述
Have you ever thought about comparing the weight of fruits? That’s what you should do in this problem! Given a series of fruit weight comparisons, you should anticipate the result of another comparison. In this problem, all fruits of the same kind are identical and have the same weights. Each fruit weight comparison is something like “a X ≤ b Y” in which a and b are positive integers, and X and Y are fruit names. Such a comparison means that the weight of a fruits of type X is less than or equal to the weight of b fruits of type Y.
输入解释
The input contains multiple test cases. Each test case starts with a line containing n, which is the number of given comparisons. Each of the next n lines gives a comparison in the form of “a X b Y” meaning that “a X ≤ b Y”. The last line of each test case contains the comparison query in the same form of “a X b Y” inquiring the comparison of “a X” and “b Y”.

A case of n = 0 shows the end of input and should not be processed. All integers in the input (except the last n which is 0) are positive and are not greater than 100. Fruit names are case-sensitive strings of (lowercase and uppercase) letters with length no more than 50.
输出解释
For each test case, write one line with your result for that test case. Your result can be one of the followings (assume the comparison query was “a X b Y”):
“<=”: meaning you are sure that “a X ≤ b Y”.
“>=”: meaning you are sure that “a X ≥ b Y”.
“==”: meaning you are sure that “a X = b Y” (i.e. you have reached both of the above results).
“UNAVAILABLE”: meaning that you can say nothing for sure in comparing “a X” and “b Y” (i.e. you have reached none of the above results).
“INCONSISTENT”: meaning that there is an inconsistency in the given comparisons (i.e. you are sure that all the given comparisons for that test case cannot hold at the same time).
输入样例
2
2 Orange 3 Apple
1 Apple 1 Peach
2 Orange 3 Peach
1
2 Orange 3 Apple
2 Orange 2 Apple
2
3 a 2 A
2 A 3 a
5 A 5 a
2
3 B 2 A
2 A 3 B
2 A 3 B
3
2 b 2 A
2 A 2 C
3 C 2 b
1 A 1 b
0
输出样例
<=
UNAVAILABLE
>=
==
INCONSISTENT

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

题目来源 Tehran 2009

源链接: POJ-3860

最后修改于 2020-10-29T07:14:01+00:00 由爬虫自动更新

共提交 0

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