20211.14 CF训练f题

24 篇文章 0 订阅
24 篇文章 0 订阅
本文探讨了在化学实验中构建分子的过程,强调了原子键合规则的重要性。每个原子都有特定的价电子数,需与其他原子形成键以满足稳定状态。通过举例和数学推导,解释了如何根据三个原子的价电子数找到合适的键合方式,以及为何某些配置不可行。文章指出,键的总数必须等于所有原子价电子数之和的一半,并且原子不能与自身形成键。对于无法形成稳定分子的情况,给出了“不可能”的结论。
摘要由CSDN通过智能技术生成

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 a, b 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.
在这里插入图片描述
思路:首先满足的条件:
1.所有原子的阶数之和必须时偶数,否则就会有单键多出来;
2.其次,自己不能和自己相接,所以,不能出现一个原子的阶数大于另外两个阶数之和。如果大于,多出来的阶数只能和自己相接,不成立;
核心:
1.首先,要明白,键数与原子阶数的关系,后者为前者的两倍;不妨设阶数为a,b,c,a和b之间键数为x;b和c为y;a和c为z;就有x+y+z==(a+b+c)/2…(1)
下面的方程(这就不要解释怎么来的了吧)
a=x+z;…(2)
b=x+y;…(3)
c=z+y;…(4)
解上面列的(1)(2)(3)(4)方程得:
x=(a+b-c)/2;
y=(b+c-a)/2;
z=(a+c-b)/2;
ac代码:

#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
	LL a,b,c,x,y,z;
	cin>>a>>b>>c;
	x=(a+b-c)/2;
	y=(b+c-a)/2;
	z=(a+c-b)/2;
	if(x<0||y<0||z<0||(a+b+c)%2) cout<<"Impossible"<<endl;
	else cout<<x<<" "<<y<<" "<<z<<endl;
	return 0;
}

总结:一开始找不到关系,也就没有思路,这tm就是变相在考化学,所以学acm还要是个全能人才才行。。。。哈哈 : D

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值