CodeForces - 344B Simple Molecules (模拟题)
CodeForces - 344B
id=46665" class="login ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" style="display:inline-block; position:relative; padding:0px; margin-right:0.1em; vertical-align:middle; overflow:visible; text-decoration:none; font-family:Verdana,Arial,sans-serif; border:1px solid rgb(211,211,211); color:blue; font-size:12px!important">Submit Description 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 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) 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 Sample Input
Input
1 1 2
Output
0 1 1
Input
3 4 5
Output
1 3 2
Input
4 1 1
Output
Impossible Hint 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. 如果A、B、C代表原子的化合价 如果x、y、z代表原子之间的化学键 首先x+y+z一定为偶数,否则不可能有解。 那么能够列出一个三元一次的方程组。由3个方程组成,能够求出唯一解。 推断有解的唯一限制条件是:不能出现负数。
#include <iostream> |
CodeForces - 344B Simple Molecules (模拟题)的更多相关文章
- Codeforces 344B Simple Molecules
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; scanf("%d%d%d", ...
- Codeforces 767B. The Queue 模拟题
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...
- Codeforces 691C. Exponential notation 模拟题
C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: st ...
- codeforces B. Simple Molecules 解题报告
题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...
- CodeForces - 344D Alternating Current (模拟题)
id=46667" style="color:blue; text-decoration:none">CodeForces - 344D id=46667" ...
- CodeForces - 344E Read Time (模拟题 + 二分法)
E. Read Time time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- CodeForces - 665D Simple Subset 想法题
//题意:给你n个数(可能有重复),问你最多可以取出多少个数使得任意两个数之和为质数.//题解:以为是个C(2,n)复杂度,结果手摸几组,发现从奇偶性考虑,只有两种情况:有1,可以取出所有的1,并可以 ...
- CodeForces 681C Heap Operations (模拟题,优先队列)
题意:给定 n 个按顺序的命令,但是可能有的命令不全,让你补全所有的命令,并且要求让总数最少. 析:没什么好说的,直接用优先队列模拟就行,insert,直接放入就行了,removeMin,就得判断一下 ...
- Codeforces Beta Round #7 B. Memory Manager 模拟题
B. Memory Manager 题目连接: http://www.codeforces.com/contest/7/problem/B Description There is little ti ...
随机推荐
- getRequestURI,getRequestURL的区别,获取各种路径的方法
getRequestURI,getRequestURL的区别 test1.jsp======================= <a href ="test.jsp?p=fuck&qu ...
- HLG1125 循环小数2
循环小数 II Time Limit: 1000 MS Memory Limit: 65536 K Total Submit: 155(55 users) Total Accepted: 92(51 ...
- java实现图的深度优先遍历和广度优先遍
首先需要知道的是,图的深度优先遍历是一种类似于树的前序遍历方式,即选择一个入口节点,沿着这个节点一直遍历下去,直至所有节点都被访问完毕:如果说,图的深度优先遍历类似于树的前序遍历的话,那么图的广度优先 ...
- P2412 查单词
题目背景 滚粗了的HansBug在收拾旧英语书,然而他发现了什么奇妙的东西. 题目描述 udp2.T3如果遇到相同的字符串,输出后面的 蒟蒻HansBug在一本英语书里面找到了一个单词表,包含N个单词 ...
- gcc编译生成静态及动态链接库步骤
gcc编译生成静态及动态链接库步骤 这两天在看<Linux C程序设计大全>,吴岳编著,清华大学出版社.这本书是在一个培训机构看到的,在网上查了下该书的相关信息.从目录而言,该书涵盖了Li ...
- 关于Delphi cxGrid主从表中从表只能编辑第一条记录的问题
在Delphi cxGrid主从表中从表只能编辑第一条记录,这个问题是由于设置主从关联字段错误造成的. 从表DBtableView2的keyfieldnames,DetailKeyFieldNames ...
- Array拼接字符串
原文发布时间为:2011-01-12 -- 来源于本人的百度文章 [由搬家工具导入] Array拼接字符串本来就是一种投机取巧的无聊玩意,来源是IE6对字符串的+实现错误一般情况下,如果是语义性的字符 ...
- poj 3623 Best Cow Line, Gold 后缀数组 + 贪心
题目链接 题目描述 对于一个给定的字符串,可以从左右两端取字符,依次排列构成一个新的字符串. 求可能构成的字符串中字典序 最小的一个. 例:ACDBCB -> ABCBCD 思路 参考自 xue ...
- 《手把手教你学C语言》学习笔记(4)---代码规范
编程过程中需要遵守编译器的各种约定,例如以下代码: 1 #include <stdio.h> 2 3 int main(int argc, char **argv) 4 { 5 print ...
- iOS直播Liveroom组件,游客,用户多次切换登录同一直播间,消息出现多次重复问题解决
byzqk 新版,加入连麦功能,直播的流程修改很多,每次登录都需要登录liveroom组件 期间遇到一个奇葩的问题,就是游客登录组件之后,切换为用户登录,出现im消息重复的问题,一开始以为是游客退出不 ...