time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

 

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.

Input

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

Output

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).

Examples
input
1 1 2
output
0 1 1
input
3 4 5
output
1 3 2
input
4 1 1
output
Impossible
Note

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.

水题 求3个原子是否能构成一个分子使化学键和法。

总共的化学键为(a+b+c)/2个,则只要判断各原子间化学键是否成立即可。

附AC代码:

 #include<bits/stdc++.h>
using namespace std; int main(){
int a,b,c;
cin>>a>>b>>c;
int t=(a+b+c)/;
int ans=;
int a1,a2,a3;
int flag=;
for(int i=;i<a;i++){
a1=i,a3=a-a1,a2=t-a;
if(a1+a2==b&&a2+a3==c){
flag=;
break;
}
}
if(flag==){
for(int i=;i<b;i++){
a1=i,a2=b-a1,a3=t-b;
if(a1+a3==a&&a2+a3==c){
flag=;
break;
}
}
}
if(flag==){
for(int i=;i<c;i++){
a3=i,a2=c-a3,a1=t-c;
if(a1+a3==a&&a2+a1==b){
flag=;
break;
}
}
}
if(flag&&a1>=&&a2>=&&a3>=){
cout<<a1<<" "<<a2<<" "<<a3<<endl;
}
else{
cout<<"Impossible"<<endl;
}
return ;
}

B. Simple Molecules的更多相关文章

  1. Simple Molecules(简单)

    Simple Molecules time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  2. CodeForces - 344B Simple Molecules (模拟题)

    CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...

  3. codeforces Simple Molecules

    link:http://codeforces.com/contest/344/problem/B 刚开始想复杂了.一开始就想当然地以为可以有多个点,其实,人家题目要求只有3个点啊! 然后题目就简单了. ...

  4. codeforces B. Simple Molecules 解题报告

    题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...

  5. cf B. Simple Molecules

    http://codeforces.com/contest/344/problem/B #include <cstdio> #include <cstring> using n ...

  6. Codeforces 344B Simple Molecules

    #include<bits/stdc++.h> using namespace std; int main() { int a,b,c; scanf("%d%d%d", ...

  7. CodeForces Round 200 Div2

    这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准 ...

  8. 我看的公开课系列--《TED:对无知的追求》 by stuart firestein

    http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect fact ...

  9. Codeforces Round #200 (Div. 1 + Div. 2)

    A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的, ...

随机推荐

  1. ClassLoader Java中类加载出现在哪个阶段,编译期和运行期? 类加载和类装载是一样的吗

    1.ClassLoader Java中类加载出现在哪个阶段,编译期和运行期? 类加载和类装载是一样的吗? :当然是运行期间啊,我自己有个理解误区,改正后如下:编译期间编译器是不去加载类的,只负责编译而 ...

  2. UITableView性能的优化

    转载自http://hi.baidu.com/iosme/item/24e34c465b8b1636fb896075 1.使用不透明视图.
 不透明的视图可以极大地提高渲染的速度.因此如非必要,可以将 ...

  3. Codeforces Round #178 (Div. 2) B .Shaass and Bookshelf

    Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensi ...

  4. jQuery开发之Ajax

    1.load()方法 (1)load()方法是jQuery中最经常使用和最简单的Ajax方法,能载入远程HTML代码,并插入代码中. 它的结构为: load(url [,data] [,callbac ...

  5. grunt 试用笔记

    Gruntjs是JavaScript项目的构建工具,也是基于node的一个命令行工具.很多开源JS项目都是使用它搭建.如jQuery.Qunit.CanJS等.它有以下作用 合并JS文件压缩JS文件单 ...

  6. binary-tree-preorder-traversal——前序遍历

    Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tr ...

  7. MAC上Nuclide的安装

    MAC上Nuclide的安装 本文版权归作者全部,如需转载请联系孟祥月 CSDN博客:http://blog.csdn.net/mengxiangyue 独立博客:http://mengxiangyu ...

  8. php闭包实例

    php闭包函数,一个典型的实例 function getMoney() { $rmb = 1; $dollar = 6; $func = function($dollar) use (&$rm ...

  9. 【万里征程——Windows App开发】控件大集合1

    加入控件的方式有多种.大家更喜欢哪一种呢? 1)使用诸如 Blend for Visual Studio 或 Microsoft Visual Studio XAML 设计器的设计工具. 2)在 Vi ...

  10. BAT&注册表重定向劫持

    RunJS 常用引导,有时启动某个应用需要环境变量可以这样启动应用,会对启动的进程生效,即被继承 set PATH=D:\Developer\sdk\platform-tools;%PATH% D: ...