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. winform客户端程序实时读写app.config文件

    新接到需求,wcf客户端程序运行时,能实时修改程序的打印机名称: 使用XmlHelper读写 winform.exe.config文件修改后始终,不能实时读取出来,查询博客园,原来已有大神解释了: 获 ...

  2. Android:BLE智能硬件开发详解

    目录 前言 BLE是个什么鬼 BLE中的角色分工 主要的关键词和概念 GATT(Generic Attribute Profile ) Characteristic Service Android如何 ...

  3. influxdb的python操作

    1.先安装依赖:pip install influxdb 2.

  4. 干货--安装eclipse-hadoop-plugin插件及HDFS API编程两个遇到的重要错误的解决

    在Windows的eclipse上写hdfs的API程序,都会遇到两个错误,在网上查了很多资料,都没有解决的办法,经过了很多时间的研究,终于把这个问题解决了 错误是 1.java.io.IOExcep ...

  5. python 工具 FFT变换

    import numpy as npimport pylabwave_data =np.fromfile("C:\\Users\\Administrator\\Desktop\\bins\\ ...

  6. Js学习第十天----函数

    函数 什么是函数?函数是由事件驱动的或者当他被调用时运行的可反复使用代码块.预计没明确,个人觉得函数就是能完毕一个功能的代码块. 看个案例: <!DOCTYPE html> <htm ...

  7. UFLDL教程(一)---稀疏自编码器

    神经网络模型 简单的神经网络 前向传播 代价函数 对于单个例子 .其代价函数为: 给定一个包括m个例子的数据集,我们能够定义总体代价函数为: 以上公式中的第一项  是一个均方差项. 第二项是一个规则化 ...

  8. cin,和几个get函数的用法

    1.cin.get(字符变量名):用来接收字符 ch = cin.get(); cin.get(ch); 以上两者均可以 2.cin.get(字符数组名,接收字符数目)用来接收一行字符串,可以接收空格 ...

  9. opencvSGBM半全局立体匹配算法的研究(1)

    转载请说明出处:http://blog.csdn.net/zhubaohua_bupt/article/details/51866567 这段时间对opencvSGBM半全局立体匹配算法进行了比較仔细 ...

  10. 当电视沦为“情怀”,5G能不能拯救它?(zz)

    文|佘凯文 来源|智能相对论(aixdlun) 现阶段,智能家居行业极度期待5G的到来,甚至超过手机.行业对于颠覆性的升级的欲望极其强烈,纵观整个智能家居行业,除了像智能音箱外的偶尔单品能够“引爆”市 ...