CF47B.Coins

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One day Vasya came across three Berland coins. They didn't have any numbers that's why Vasya didn't understand how their denominations differ. He supposed that if one coin is heavier than the other one, then it should be worth more. Vasya weighed all the three pairs of coins on pan balance scales and told you the results. Find out how the deminations of the coins differ or if Vasya has a mistake in the weighting results. No two coins are equal.

一天,瓦西娅遇到了三枚贝尔兰硬币。这些硬币上没有任何数字,因此瓦西娅无法分辨它们的面值差异。他推测:如果一枚硬币比另一枚重,那么它的面值就应该更高。瓦西娅用天平称量了所有三对硬币,并将结果告诉了你。请判断这三枚硬币的面值大小关系;或者,若瓦西娅的称量结果存在矛盾,请指出其错误。任意两枚硬币的重量均不相等。

输入格式

The input data contains the results of all the weighting, one result on each line. It is guaranteed that every coin pair was weighted exactly once. Vasya labelled the coins with letters «A», «B» and «C». Each result is a line that appears as (letter)(> or < sign)(letter). For example, if coin "A" proved lighter than coin "B", the result of the weighting is A<B.

输入数据包含所有称重的结果,每行一个结果。保证每一对硬币恰好被称重一次。瓦西娅用字母「A」、「B」和「C」为硬币编号。每个结果是一行形如(字母)(> 或 < 符号)(字母)的字符串。例如,若硬币「A」比硬币「B」轻,则称重结果为 A<B。

输出格式

It the results are contradictory, print Impossible. Otherwise, print without spaces the rearrangement of letters «A», «B» and «C» which represent the coins in the increasing order of their weights.

如果结果矛盾,则输出 Impossible。否则,输出代表硬币按重量升序排列的字母 «A»、«B» 和 «C» 的重排(不带空格)。

输入输出样例

  • 输入#1

    A&gt;B
    C&lt;B
    A&gt;C

    输出#1

    CBA
  • 输入#2

    A&lt;B
    B&gt;C
    C&gt;A

    输出#2

    ACB

输入解题思路,AI测评打分。不知道怎么写?

首页