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. django : related_name and related_query_name

    This post is about two Django ForeignKey parameters related_name related_query_name See an example b ...

  2. mysql大数据量分页查询优化

    参考文章:https://www.dexcoder.com/selfly/article/293 Mysql的分页查询十分简单,但是当数据量大的时候一般的分页就吃不消了. 传统分页查询:SELECT ...

  3. AppCompatActivity

    刚开始看HelloWorld的目录结构然后就发现Android Studio中的是 import android support.v7.app.AppcompatActivity; public cl ...

  4. 全能无线渗透测试工具,一个LAZY就搞定了

    近来一直在研究无线安全方面的东西,特别是在无线渗透测试这块,每次渗透测试时总要来回不停的切换操作和挑选利器,很是麻烦.就想看看是否可以有一款功能全面的集合型工具. 正所谓功夫不负有心人,还真有这么一个 ...

  5. malloc动态分配多维数组

    下面试自己写的三个测试程序,如果看懂了基本上动态分配多维数组就没什么问题啦:重点 1:深刻理解多维数组的概念,多维数组在内存中的分配情况,基本上动态分配也没什么问题的.然后还要注意一点的就是,释放是分 ...

  6. 为什么一个目录里放超过十个Mp4文件会导致资源管理器和播放程序变卡变慢?

    最近<鬼吹灯之精绝古城>大火,我也下载了剧集放在移动硬盘里. 起初还没事,当剧集超过十个时发现资源管理器变慢了,表现为上方的绿条总是在闪动前进,给文件改名都缓慢无比. 当剧集超过十五个时, ...

  7. 改动Xmodem/Zmodem上传下载路径

    SecureCRT能够使用Xmodem/Zmodem方便的上传和下载文件. 在Session ptions =>Xmodem/Zmodem => Directories中设置   选项=& ...

  8. innodb 修改表共享空间为独立空间

    最近在优化mysql innodb存储引擎,准备把共享表空间转换成独立表空间.刚开始的没考虑这么多,过段时间又要推广,所以优化一下,看看效果如何.说一个转换过程. 1,查看一下是共享表空间,还是独立表 ...

  9. nc和telnet配合使用

    nc -l 9932 -c  用nc监听9932端口 telnet 180.150.184.115 29933  telnet 29932 端口

  10. ViewPagerIndicator 取代TabHost,实现滑动tab,引导页等效果

    https://github.com/eltld/ViewPagerIndicator 取代TabHost,实现滑动tab,引导页等效果