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 ...
随机推荐
- 【263】Linux 添加环境变量 & 全局 shell 脚本
Linux电脑添加环境变量 方法一:通过修改 profile 文件添加环境变量 1. 打开终端,输入[vi /etc/profile],如下所示,点击回车 [ocean@ygs-jhyang-w1 L ...
- Springboot中AOP统一处理请求日志
完善上面的代码: 现在把输出信息由先前的system.out.println()方式改为由日志输出(日志输出的信息更全面) 现在在日志中输出http请求的内容 在日志中获取方法返回的内容
- vue 滚动加载数据
参考链接:https://www.npmjs.com/package/vue-infinite-scroll
- Condition实现多个生产者多个消费者
Condition实现多对多交替打印: import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.R ...
- opencv3.2 编译安装说明
Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the ...
- gcc 升级方法
Want GCC 4.8 with c++11 complete feature? Well here’s how to install it in Ubuntu 12.04, Ubuntu 13.0 ...
- 华为JAVA机试流程
1.JAVA机试流程:①打开IE浏览器,输入机试系统IP地址(以当天告知的地址为准):②输入姓名.手机,选择“C/C++”或“JAVA”,登录:③登录后显示题目,阅读题目并点击页面最下方的“下载框架文 ...
- Django扩展Auth-User表的几种方法
方式1, OneToOneField from django.contrib.auth.models import Userclass UserProfile(models.Model): user ...
- 数据结构 station
问题描述 一天,小 L 突然对列车的进出站问题产生了兴趣,如下图所示:列车只能从 A 进站,或从 B 出站.列车从 A 进站,进站顺序为 1, 2, 3, 4, 5列车从 B 出站,出站顺序为 5, ...
- Java之封装特性
Java中的三大特性:继承,封装,多态: 其中封装概念:封装是把过程和数据包围起来,对数据的访问只能通过已定义的接口. 面向对象计算始于这个基本概念,即现实世界可以被描绘成一系列完全自治.封装的 对象 ...