2.9英文题面翻译

描述

Professor John is investigating a math problem. He has obtained some relations among several variables. Now he would like to know if there are any other relations that can be deduced from these obtained ones. For example, the known relations are given as follows: A < B, C > B and C < D, other relations including A < C, A < D and B < D can be deduced. Since he has been working for too long, Professor John decides to grant himself a vacation while assigning you to do the job. Are you ready?

输入

The first line of input contains an integer N, which is the number of test cases. Then N test cases follow. For each test case: the 1st line contains a positive integer m (<= 100) which is the number of given relations; the following m lines each contains a given relation, in the format Variable1 < Variable2 or Variable1 > Variable2
A "Variable" is represented by a capital character. There will not be conflicting relations given.

输出

For each test case, first print in one line "Case d:" where d is the number of the test case, start counting from 1. Then output all the relations which can be deduced from the given relations in alphabetical order, in the format Variable1 < Variable2. Each relation occupies one line. No extra space shall be printed. The given relations must NOT be included. If no new relation is found, output "NONE" in one line.

OpenJudge - 3529:Professor John

翻译

描述

约翰教授正在研究一道数学题。他得到了几个变量之间的一些关系。现在他想知道从这些关系式中是否还能推导出其他关系式。例如,已知关系给出如下:A < B, C > B和C < D,其他关系包括A < C, A < D, B < D。由于他已经工作了太长时间,约翰教授决定给自己一个假期,同时指派你做这项工作。你准备好了吗?

输入

输入的第一行包含一个整数N,它是测试用例的数量。然后是N个测试用例。对于每个测试用例:第一行包含一个正整数m(<= 100),这是给定关系的数量;下面的m行每一行都包含一个给定的关系,格式为Variable1 < Variable2或Variable1 > Variable2
“变量”由大写字符表示。不会有冲突的关系。

输出

对于每个测试用例,首先在一行中输出“Case d:”,其中d是测试用例的序号,从1开始计算。然后按字母顺序输出从给定关系导出的所有关系,格式为Variable1 < Variable2。每个关系占据一条直线。没有额外的空间应印刷。不应包括给定的关系。如果没有找到新的关系,则在一行中输出“NONE”。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值