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的更多相关文章

  1. CodeForces - 344B Simple Molecules (模拟题)

    CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...

  2. Simple Molecules(简单)

    Simple Molecules time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  3. codeforces B. Simple Molecules 解题报告

    题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...

  4. Codeforces 344B Simple Molecules

    #include<bits/stdc++.h> using namespace std; int main() { int a,b,c; scanf("%d%d%d", ...

  5. cf B. Simple Molecules

    http://codeforces.com/contest/344/problem/B #include <cstdio> #include <cstring> using n ...

  6. B. Simple Molecules

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  7. CodeForces Round 200 Div2

    这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准 ...

  8. Codeforces Round #200 (Div. 1 + Div. 2)

    A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的, ...

  9. 我看的公开课系列--《TED:对无知的追求》 by stuart firestein

    http://open.sina.com.cn/course/id_1047/ What scientists do is not just collect data and collect fact ...

随机推荐

  1. 使用Crowd2.7集成Confluence5.3与JIRA6.1,并安装、破解及汉化,实现单点登录【原创】

      鉴于目前没有针对Crowd.Confluence.Jira安装.集成和破解最新的方法,总结今天安装.破解及集成的经验,编写此文,方便大家进行配置也方便自己以后参考.此文参考多篇破解文章,并经过作者 ...

  2. java字符串大小写字母互改

    import java.util.Scanner; public class Test { /** * 测试数据 * * @param args */ public static void main( ...

  3. AAS代码运行-第4章

    [root@node1 aas]# ls ch02 ch03 spark--bin-hadoop2. spark--bin-hadoop2..tgz [root@node1 aas]# cd spar ...

  4. js图片放大效果

    实现购物网站里的图片放大效果,jqzoom很好用.今天才接触它,很快就上手了.看了一个示例,在放大图像上方貌似有水印,后经排查,原来是图片的标题,然后设置title为false,搞定.

  5. 百度前端技术学院2015JavaScript基础部分-BOM

    5.1 任务描述 实现以下函数 // 判断是否为IE浏览器,返回-1或者版本号 function isIE() { // your implement } // 设置cookie function s ...

  6. 005-Scala数组操作实战详解

    005-Scala数组操作实战详解 Worksheet的使用 交互式命令执行平台 记得每次要保存才会出相应的结果 数组的基本操作 数组的下标是从0开始和Tuple不同 缓冲数组ArrayBuffer( ...

  7. Uploadify使用随笔

    最近项目使用了Uploadify一个上传插件,感觉的挺好用的. 上传控件: 引用JS <script src='<% =ResolveUrl("~/JS/Uploadify/jq ...

  8. 探索javascript----this的指向问题

    *this只和执行环境有关,和声明环境无关.谁调用this,this就指向谁. *this的指向分为四种: 1.作为普通函数调用: 2.作为对象的方法调用:   指向对对象,但用新变量引用该方法时候, ...

  9. vmware 安装 macos

    http://jingyan.baidu.com/article/ff411625b9011212e48237b4.html

  10. 当想mysql某插入有某字段设置了unique且和之前相同时,会报错,并停止运行