Eming
来源:互联网 发布:英语课文翻译软件 编辑:程序博客网 时间:2024/06/06 11:38
Emingis a contest hold by WHUACM training team. The aim is to select new members ofthe team.
Usually, the first problem is a very simpleproblem such as “a+b problem”. But this time, Xioumu is tired of this kind of problem,he decide to solve “a and b problem”.
Give you the result of a + b and a^2 – b^2,please output the result of a and b.
Input
There are several test cases. For each casethere are two double numbers indicating a+b and a^2-b^2. You may assume that a+bwill not be zero.
Output
For each case please output the result of aand b in one line, rounded to 2 decimal places.
SampleInput
3 -3
SampleOutput
1.00 2.00
试题分析:这道题意思是给了a+b和a^2 – b^2的值,要求a和b的值,如果直接暴力枚举的话肯定会超时,所以运用数学上的运算就可以了,给(a+b)平方再加上 a^2 – b^2,再除以2*(a+b),得出a的值,则可得b的值。下面是代码:
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <cstdlib>using namespace std;int main() { double A, B, C; while(scanf("%lf%lf", &A, &B) == 2) { C = B / A; printf("%.2lf %.2lf\n", (A + C) * 0.5, (A - C) * 0.5); } return 0;}
- Eming
- Eming
- Eming
- [第一次训练]Eming
- 暑假第一场A。Eming
- A.Eming(13.7.7)
- 关于对Eming杯的总结
- Eming Cup 现场赛 A-Divide
- Eming Cup 网络赛 B-Topcoder
- 20130707 【南华大学 ACM】 新生赛第一场 【A.Eming】
- 南华大学ACM第一场个人联系赛 A Eming
- 武汉大学第六届Eming杯程序设计竞赛初赛
- 2015武汉大学第八届Eming杯现场赛E题题解
- Apache Struts2打开重定向/命令执行 CVE-2013-2251
- 156 - Ananagrams
- TQ210开发板NFS挂载android4.0.4的rootfs的方法
- android-goldfish-2.6.29升级到android-goldfish-3.4之后, 普通权限的apk读logs时只能读到自己的打印信息
- linux诡异的半连接(SYN_RECV)队列长度
- Eming
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedExcept
- nyoj-16-矩形嵌套
- spring mvc 框架搭建及详解
- 在全局页面缓存中显示登录信息
- GPFS安装配置
- EditText插入表情,模仿聊天页面
- Extjs实战(Extjs+Spring+Hibernate+dwr)章一:各框架的整合
- android 所有焦点问题汇总【Focus】