CF344B.Simple Molecules

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.

A molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom has a valence number — the number of bonds the atom must form with other atoms. An atom can form one or multiple bonds with any other atom, but it cannot form a bond with itself. The number of bonds of an atom in the molecule must be equal to its valence number.

Mike knows valence numbers of the three atoms. Find a molecule that can be built from these atoms according to the stated rules, or determine that it is impossible.

疯狂科学家迈克正在忙于进行化学实验。今天,他将尝试将三个原子连接成一个分子。

一个分子由若干原子组成,其中某些原子对之间通过化学键相连。每个原子都有一个价数——即该原子必须与其他原子形成的键的数量。一个原子可以与另一个原子形成一条或多条键,但不能与自身成键。分子中每个原子所形成的键的数量必须等于其价数。

迈克已知这三个原子的价数。请找出一个能由这三个原子按上述规则构成的分子,或判断这是不可能的。

输入格式

The single line of the input contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 106) — the valence numbers of the given atoms.

输入仅包含一行,其中为三个以空格分隔的整数 aa、bb 和 cc(1 ≤ a, b, c ≤ 1061 \leq a,\,b,\,c \leq 10^6)——分别为给定原子的化合价数。

输出格式

If such a molecule can be built, print three space-separated integers — the number of bonds between the 1-st and the 2-nd, the 2-nd and the 3-rd, the 3-rd and the 1-st atoms, correspondingly. If there are multiple solutions, output any of them. If there is no solution, print "Impossible" (without the quotes).

如果可以构建这样的分子,请输出三个用空格分隔的整数——分别表示第 1 个与第 2 个原子、第 2 个与第 3 个原子、第 3 个与第 1 个原子之间的化学键数目。若存在多个解,输出任意一个即可。若无解,则输出 "Impossible"(不带引号)。

输入输出样例

  • 输入#1

    1 1 2

    输出#1

    0 1 1
  • 输入#2

    3 4 5

    输出#2

    1 3 2
  • 输入#3

    4 1 1

    输出#3

    Impossible

说明/提示

The first sample corresponds to the first figure. There are no bonds between atoms 1 and 2 in this case.

The second sample corresponds to the second figure. There is one or more bonds between each pair of atoms.

The third sample corresponds to the third figure. There is no solution, because an atom cannot form bonds with itself.

The configuration in the fourth figure is impossible as each atom must have at least one atomic bond.

第一个样例对应第一张图。本例中原子 1 和原子 2 之间没有化学键。

第二个样例对应第二张图。每一对原子之间都存在一个或多个化学键。

第三个样例对应第三张图。该情形无解,因为一个原子不能与自身形成化学键。

第四张图所示的构型是不可能的,因为每个原子必须至少拥有一个化学键。

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

首页