📄 problem 1589.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=1589 -->
<HTML><HEAD><TITLE>Problem 1589</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<CENTER><IMG src="Problem 1589.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>Professor John</FONT></CENTER>
<HR>
<CENTER><FONT color=green>Time limit:</FONT> 1 Seconds <FONT
color=green>Memory limit: </FONT>32768K </FONT><BR><FONT
color=green>Total Submit:</FONT> 1511 <FONT color=green>Accepted
Submit:</FONT> 576 </CENTER>
<HR>
<H2 align=center>Sunny Cup 2003 - Preliminary Round</H2>
<P align=center>April 20th, 12:00 - 17:00 </P>
<H3 align=center>Problem H: Professor John</H3>
<P><BR>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. 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?</P>
<P><BR><B>Input</B></P>
<P>The first line of input contains an integer N, which is the number of test
cases. Then N test cases follow.<BR><BR>For each test case:<BR><BR>the 1st line
contains a positive integer m (<= 100) which is the number of given
relations;<BR><BR>the following m lines each contains a given relation, in the
format</P>
<P>Variable1<Variable2</P>
<P>or</P>
<P>Variable1>Variable2</P>
<P>A "Variable" is represented by a capital character. There will not be
conflicting relations given.</P>
<P><BR><B>Output</B></P>
<P>For each test case, first print in one line "Case d:" where d is the number
of the test case, start counting from 1.<BR><BR>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.<BR><BR>If no new
relation is found, output "NONE" in one line.</P>
<P><BR><B>Sample
Input</B><BR><BR>2<BR>3<BR>A<B<BR>C>B<BR>C<D<BR>2<BR>A<B<BR>C<D</P>
<P><BR><B>Sample Output</B><BR><BR>Case 1:<BR>A<C<BR>A<D<BR>B<D<BR>Case
2:<BR>NONE<BR></P>
<P><BR><B>Author:</B> <I>XU, Chuan</I></P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>Zhejiang University Local
Contest 2003, Preliminary</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=1589">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=6">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=1589">Status</A> </CENTER>
<HR>
<CENTER>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=right width="65%"><A href="http://acm.zju.edu.cn/"><FONT
color=red>Zhejiang University Online Judge</FONT></A> <A
href="http://acm.zju.edu.cn/"><FONT color=red>V1.0</FONT></A></TD>
<TD align=right width="35%"><A href="http://www.zzhang.cn/"><FONT
color=#ffffff
size=-3>Book</FONT></A></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -