codeforces Simple Molecules
link:http://codeforces.com/contest/344/problem/B
刚开始想复杂了。一开始就想当然地以为可以有多个点,其实,人家题目要求只有3个点啊!
然后题目就简单了。
A、B、C代表原子的化合价
x、y、z代表原子之间的化学键
首先x+y+z一定为偶数,否则不可能有解。
那么可以列出一个三元一次的方程组,由3个方程组成,可以求出唯一解。
判断有解的唯一限制条件是:不能出现负数。
#include <cstdlib> #include <cstdio> #include <cmath> int main(void) { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif // ONLINE_JUDGE int a, b, c; int x, y, z; while (~scanf("%d%d%d", &a, &b, &c)) { int sum = a + b + c; ) { printf("Impossible\n"); continue; } int tmp = b - a + c; ) { printf("Impossible\n"); continue; } y = tmp >> ; z = c - y; x = a - z; || y < || z < ) { printf("Impossible\n"); continue; } printf("%d %d %d\n", x, y, z); } ; }
看题要认真。不把问题复杂化。
codeforces Simple Molecules的更多相关文章
- CodeForces - 344B Simple Molecules (模拟题)
CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...
- Simple Molecules(简单)
Simple Molecules time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- codeforces B. Simple Molecules 解题报告
题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...
- Codeforces 344B Simple Molecules
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c; scanf("%d%d%d", ...
- cf B. Simple Molecules
http://codeforces.com/contest/344/problem/B #include <cstdio> #include <cstring> using n ...
- B. Simple Molecules
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- CodeForces Round 200 Div2
这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准 ...
- Codeforces Round #200 (Div. 1 + Div. 2)
A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的, ...
- 我看的公开课系列--《TED:对无知的追求》 by stuart firestein
http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect fact ...
随机推荐
- React之事件绑定、列表中key的使用
在学习React的Hadding Events这一章节,发现事件回调函数的几种写法,看似区别不大,但实际差异还是蛮大的. class Toggle extends React.Component{ c ...
- (c语言编程)出现错误:null undeclared identifier
原因:没有添加头文件#include <stdio.h> 添加完头文件后,错误消失
- kendo-ui学习笔记(一)
1.top.jsp: <script src="<%=path%>/kendoui/js/jquery.min.js"></script> &l ...
- Servlet入门
1.在tomcat中新建一个day01web应用,然后在web应用中新建一个web-inf/classes目录:2.在classes目录中新建一个FirstServlet.java文件:package ...
- CodeSimth - .Net Framework Data Provider 可能没有安装
使用CodeSimth 连接SQLite数据库库 提示错误 codesmith 6以上的版本,说是支持sqlite生成,也有对应的sqliteprovider.dll,但是使用时却说Test fail ...
- 关于ssh调用远程后台命令挂住的解释
目前看到的最详细最全面的解释: http://www.snailbook.com/faq/background-jobs.auto.html
- MySQL数据库4 - 查看数据表
一. 查看表的基本结构 语法:DESCRIBE/DESC TABLE_NAME 查询结果含义: Field: 字段名 Type: 字段类型 Null: 是否可以为空 Key: 是否编制索引 defau ...
- Vue.js的计算属性
开始用vue会把所有的模版上的数据都放到data属性里,或者有的时候data属性里变量多了之后觉得有些只是用一次的变量就直接写到模版里了,后来看到同组的同事在用computed属性,就又去查了一下ap ...
- ubuntu 15.10 install nvidia driver
先添加源sudo add-apt-repository ppa:graphics-drivers/ppa 更新一下:sudo apt-get update (附原始链接:http://www.omgu ...
- VS2010+PCL配置
原文出自(转载): http://blog.csdn.net/renshengrumenglibing/article/details/9073675 1.安装 pcl 的完全安装包可以到: http ...