Experimental Educational Round: VolBIT Formulas Blitz N
Description
The Department of economic development of IT City created a model of city development till year 2100.
To prepare report about growth perspectives it is required to get growth estimates from the model.
To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots.
The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one.
The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation.
In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6.
1 30 200
-10.000000000000000
-20.000000000000000
简单求解
其实注意一下a=0 然而测试数据并没有
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x7fffffff
#define INF 0x7fffffffffffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
double v[2];
int main()
{
double a,b,c,x1,x2,delta;
cin>>a>>b>>c;
if (a!=0)
{
delta=b*b-4*a*c;
if (delta>=1e-9)
{
v[0]=(-b+sqrt(delta))/(2*a);
v[1]=(-b-sqrt(delta))/(2*a);
sort(v,v+2);
printf("%.10f %.10f",v[1],v[0]);
}
}
else
{
printf("%.10f %.10f",c/b,c/b);
}
return 0;
}
Experimental Educational Round: VolBIT Formulas Blitz N的更多相关文章
- Experimental Educational Round: VolBIT Formulas Blitz
cf的一次数学场... 递推 C 题意:长度<=n的数只含有7或8的个数 分析:每一位都有2种可能,累加不同长度的方案数就是总方案数 组合 G 题意:将5个苹果和3个梨放进n个不同的盒子里的方案 ...
- Experimental Educational Round: VolBIT Formulas Blitz K
Description IT City company developing computer games decided to upgrade its way to reward its emplo ...
- Experimental Educational Round: VolBIT Formulas Blitz J
Description IT City company developing computer games invented a new way to reward its employees. Af ...
- Experimental Educational Round: VolBIT Formulas Blitz F
Description One company of IT City decided to create a group of innovative developments consisting f ...
- Experimental Educational Round: VolBIT Formulas Blitz D
Description After a probationary period in the game development company of IT City Petya was include ...
- Experimental Educational Round: VolBIT Formulas Blitz C
Description The numbers of all offices in the new building of the Tax Office of IT City will have lu ...
- Experimental Educational Round: VolBIT Formulas Blitz B
Description The city administration of IT City decided to fix up a symbol of scientific and technica ...
- Experimental Educational Round: VolBIT Formulas Blitz A
Description The HR manager was disappointed again. The last applicant failed the interview the same ...
- Experimental Educational Round: VolBIT Formulas Blitz K. Indivisibility —— 容斥原理
题目链接:http://codeforces.com/contest/630/problem/K K. Indivisibility time limit per test 0.5 seconds m ...
随机推荐
- 基于:Hadoop 2.6.0-cdh5.4.0 hive1.1.0 HBase 1.0.0-cdh5.4.0 关键配置文件
core-site.xml <configuration> <property> <name>fs.defaultFS</name> <value ...
- 正确的停止java中的线程
stop()方法不是一个正确的停止线程方法. 正确的停止方法:设置退出旗标
- Call requires API level 7 (current min is 1):(问题解决)
在一个导入的项目里修改加入webView的时候设置缩放属性的设置报错: Call requires API level 7 (current min is 1): android.webkit.Web ...
- centos 端口iptables配置
1.安装iptables yum install iptables* -y 2.打开端口 iptables -I INPUT -p tcp --dport -j ACCEPT 3.查看本机关于IPTA ...
- WarTransportation TopCoder - 8404
传送门 分析 我们高兴的发现数据范围特别小,所以我们可以随便搞.因为一共只砍掉一条路,所以我们先算出对于任意一个点如果将它的出边割掉一条则它到达终点的最坏情况的最短距离是多少,然后我们从终点向起点反着 ...
- 37LCD-TFTLCD原理与配置
1.TFTLCD驱动原理 简介
- String、StringBuffer与StringBuilder之间区别 .RP
最近学习到StringBuffer,心中有好些疑问,搜索了一些关于String,StringBuffer,StringBuilder的东西,现在整理一下. 关于这三个类在字符串处理中的位置不言而喻,那 ...
- 对Spark的理解
Spark作为一个新的分布式计算引擎正慢慢流行起来,越来越来的企业也准备用它的替换MapReduce,根据自己在工作的一些体会谈谈的优势. 分布式计算归根到底还是一个Map和Reduce操作,Map操 ...
- 2015年第六届蓝桥杯省赛试题(JavaA组)
1.结果填空 (满分3分)2.结果填空 (满分5分)3.结果填空 (满分9分)4.代码填空 (满分11分)5.代码填空 (满分13分)6.结果填空 (满分17分)7.结果填空 (满分21分)8.程序设 ...
- Sublime Text PHP Mac系统环境配置
Mac系统对于PHP运行非常友好,我们只需要进行简单的配置便可以开始进行使用,本篇文章将一步一步地介绍Apache.PHP和MySQL的安装与配置,为开始进行开发铺好路 Apache 启动Apache ...