/*
Mathematics can be so easy when you have a computer. Consider the following example. You probably know that in a right-angled triangle, the length of the three sides a, b, c (where c is the longest side, called the hypotenuse) satisfy the relation a*a+b*b=c*c. This is called Pythagora’s Law.

Here we consider the problem of computing the length of the third side, if two are given.

Input

The input contains the descriptions of several triangles. Each description consists of a line containing three integers a, b and c, giving the lengths of the respective sides of a right-angled triangle. Exactly one of the three numbers is equal to -1 (the ‘unknown’ side), the others are positive (the ‘given’ sides).

A description having a=b=c=0 terminates the input.

Output

For each triangle description in the input, first output the number of the triangle, as shown in the sample output. Then print “Impossible.” if there is no right-angled triangle, that has the ‘given’ side lengths. Otherwise output the length of the ‘unknown’ side in the format “s = l”, where s is the name of the unknown side (a, b or c), and l is its length. l must be printed exact to three digits to the right of the decimal point.

Print a blank line after each test case.

Sample Input

3 4 -1
-1 2 7
5 -1 3
0 0 0

Sample Output

Triangle #1
c = 5.000

Triangle #2
a = 6.708

Triangle #3
Impossible.

*/

#include<stdio.h>
#include<math.h> int main(){
double a,b,c;
int n=0;
while(scanf("%lf%lf%lf",&a,&b,&c)){
if(a==0&&b==0&&c==0)
break;
n++;
if (c==-1)
{
c=sqrt(a*a+b*b);
printf("Triangle #%d\n",n);
printf("c = %.3lf\n",c);
}
else
if (a==-1)
{
a=sqrt(c*c-b*b);
printf("Triangle #%d\n",n);
if (c>b)
printf("a = %.3lf\n",a);
else
printf("Impossible.\n");
}
else
if (b==-1)
{
b=sqrt(c*c-a*a);
printf("Triangle #%d\n",n);
if (c>a)
printf("b = %.3lf\n",b);
else
printf("Impossible.\n");
}
printf("\n"); } return 0;
}

ZOJ 1241 Geometry Made Simple的更多相关文章

  1. ZOJ Problem Set - 1241 Geometry Made Simple

    水题不解释 #include <stdio.h> #include <math.h> int main() { ,flag=; double a,b,c; while(scan ...

  2. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  3. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  4. MySQL所有函数及操作符

    参考:Function and Operator Reference Name Description ABS() Return the absolute value ACOS() Return th ...

  5. arcgis地图服务之 identify 服务

    arcgis地图服务之 identify 服务 在近期的一次开发过程中,利用IdentityTask工具查询图层的时候,请求的参数中ImageDisplay的参数出现了错误,导致查询直接不能执行,百度 ...

  6. 翻译:探索GLSL-用几何着色器(着色器库)实现法线可视化

    翻译:探索GLSL-用几何着色器(着色器库)实现法线可视化 翻译自: Exploring GLSL – Normal Visualizer with Geometry Shaders (Shader ...

  7. Extensions for Spatial Data

    http://dev.mysql.com/worklog/task/?spm=5176.100239.blogcont4270.8.j3asa7&id=6609 前文: 这两天因为项目原因看了 ...

  8. mysql 函数表

    Name Description ABS() Return the absolute value ACOS() Return the arc cosine ADDDATE() Add time val ...

  9. cvpr2015papers

    @http://www-cs-faculty.stanford.edu/people/karpathy/cvpr2015papers/ CVPR 2015 papers (in nicer forma ...

随机推荐

  1. centos 升级 python后 python-setuptools pip 安装依赖报错

    解决办法: $ wget https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.p ...

  2. svm特征

    svm特征格式:<label><index1>:<value1><index1>:<value1>.... 其中<label> ...

  3. C++指针详解(二)

    指针是C/C++编程中的重要概念之一,也是最容易产生困惑并导致程序出错的问题之一.利用指针编程可以表示各种数据结构,通过指针可使用主调函数和被调函数之间共享变量或数据结构,便于实现双向数据通讯:指针能 ...

  4. Apache Qpid Python 1.35.0 发布

    Apache Qpid Python 1.35.0 发布了,Apache Qpid (Open Source AMQP Messaging) 是一个跨平台的企业通讯解决方案,实现了高级消息队列协议.提 ...

  5. Android文件Apk下载变ZIP压缩包

    在azure云存储中 上传apk文件 使用ie下载 变成zip压缩包 解决方法 编辑 blob 属性和元数据 修改 内容类型 为 application/vnd.android.package-arc ...

  6. Centos使用key登录验证

    1. 新建用户lsyw 设置密码 #useradd lsyw #passwd lsyw 2. 测试新建用户可以登录 3. 修改root登录密码为通用root密码,测试用新密码登录是否成功 0!B2pj ...

  7. 高效的iOS宏定义

    iOS开发过程中使用一些常用的宏可以提高开发效率,提高代码的重用性:将这些宏放到一个头文件里然后再放到工程中的-Prefix.pch文件中(或者直接放到-Prefix.pch中)直接可以使用,灰常方便 ...

  8. [TOP10]十大渗透测试演练系统

    本文总结了目前网络上比较流行的渗透测试演练系统,这些系统里面都提供了一些实际的安全漏洞,排名不分先后,各位安全测试人员可以亲身实践如何利用这个漏洞,同时也可以学习到漏洞的相关知识. DVWA (Dam ...

  9. Ubuntu 14.10 下卸载MySQL

    前面讲了Mysql的简单安装方式,通过sudo apt-get install mysql-server 等脚本,安装之后如何卸载? 1 通过下面命令删除MySQL sudo apt-get auto ...

  10. Multiple dex files define

    Multiple dex files define 在项目中,有一个类的包名和引用的jar包中的类和包名一致