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. Struts2配置文件详解

    解决在断网环境下,配置文件无提示的问题我们可以看到Struts.xml在断网的情况下,前面有一个叹号,这时,我们按alt+/ 没有提示,这是因为” http://struts.apache.org/d ...

  2. C++小项目:directx11图形程序(三):graphicsclass

    这是框架的第三层graphicsclass,这个类才真正可以说是整个程序的框架,因为它组织了后面所有的成员. 代码: graphicsclass.h #pragma once #include< ...

  3. 正则匹配中文 UTF-8 & GBK

    在php 中: //GB2312汉字字母数字下划线正则表达式 GBK: preg_match("/^[".chr(0xa1)."-".chr(0xff).&qu ...

  4. 一个简单的金额平均分配函数(C#版)

    //总金额平均分配给总人数 //参数说明:总金额,总人数,最大金额为平均金额的倍率 public double[] GetList(double zje,int zrs,int max) { doub ...

  5. Unity3d之个性化皮肤

    1.首先创建皮肤,贴图 2.在代码中定义public GUISkin变量,在Inspector中赋值 3.在OnGUI中调用 GUI.skin = mySkin; GUI.Button(new Rec ...

  6. STM32中断管理函数

    CM3 内核支持256 个中断,其中包含了16 个内核中断和240 个外部中断,并且具有256 级的可编程中断设置.但STM32 并没有使用CM3 内核的全部东西,而是只用了它的一部分. STM32 ...

  7. JavaScript控制类名(className属性)

    语法:object.className =classname   (注意大小写) 作用:获取元素的class属性,为网页内的某个元素指定一个CSS样式来更改该元素的外观 示例: <!DOCTYP ...

  8. JAVA String,StringBuffer与StringBuilder的区别??

    String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能 ...

  9. SQL-数学、字符串、时间日期函数和类型转换

    --数学函数 --ABS绝对值,select ABS(-99)--ceiling取上限,select CEILING(4.5)--floor去下限select FLOOR(4.5)--power 几次 ...

  10. MySQL中的while、repeat、loop循环

    循环一般在存储过程和存储函数中使用频繁,这里只给出最简单的示例 while delimiter $$ create procedure test_while() begin declare sum i ...