N -
Forecast

Crawling in process...
Crawling failed
Time Limit:500MS    
Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

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.

Input

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.

Output

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.

Sample Input

Input
1 30 200
Output
-10.000000000000000
-20.000000000000000

给出了一个一元二次方程A*x^2+b*x+c=0求两个根,从小到大输出
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
double a,b,c;
double ans1,ans2;
cin>>a>>b>>c;
ans1=(-1*b+sqrt(b*b-4*a*c))/(2*a);
ans2=(-1*b-sqrt(b*b-4*a*c))/(2*a);
if(ans1>ans2)
printf("%.8lf\n",ans1),printf("%.8lf\n",ans2);
else
printf("%.8lf\n",ans2),printf("%.8lf\n",ans1);
}

Codeforces--630N--Forecast(方程求解)的更多相关文章

  1. MATLAB 符号变量表达式 + 方程求解

    源代码见文末 部分源代码: % 符号变量 两种表达方式 a=sym('a'); class(a); syms b; b; % 符号常量 c=sym('); c; % 符号表达式 三种表达方式 f1=' ...

  2. 洛谷——P1689 方程求解

    P1689 方程求解 题目描述 给一个方程,形如X+Y=Z或X-Y=Z.给出了其中两个未知数,请求出第三个数.未知数用‘?’表示,等式中也许会出现一些多余的空格. 输入输出格式 输入格式: 一行,方程 ...

  3. 洛谷 P1689 方程求解

    P1689 方程求解 题目描述 给一个方程,形如X+Y=Z或X-Y=Z.给出了其中两个未知数,请求出第三个数.未知数用‘?’表示,等式中也许会出现一些多余的空格. 输入输出格式 输入格式: 一行,方程 ...

  4. FESTUNG模型介绍—1.对流方程求解

    FESTUNG模型介绍-1.对流方程求解 1. 控制方程 对流问题中,控制方程表达式为 \[\partial_t C + \partial_x (u^1 C) + \partial_y (u^2 C) ...

  5. codeforce 630N Forecast

    N. Forecast time limit per test 0.5 seconds memory limit per test 64 megabytes input standard input ...

  6. 【来自媳妇的需求】PHP实现随机数和方程求解

    话说2015.11.06 ,北京下了第一场雪.16年的今天没下雪,但是雾霾还是不小的,帮媳妇整理她工作时,出现了下面的需求,便想到使用PHP来写程序来进行求解. [需求] 1. 给出一个平均值X,反过 ...

  7. Timus1132(二次剩余方程求解)

    题目:http://acm.timus.ru/problem.aspx?space=1&num=1132 题意:就是给出方程,p为素数,求在区间内的解. 这个思路很简单,详见:http://a ...

  8. ZOJ 3329 One Person Game (经典概率dp+有环方程求解)

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3329 题意:现在有三个骰子,分别有k1,k2和k3面,面上的点就是1~ki ...

  9. HDU 3292 【佩尔方程求解 && 矩阵快速幂】

    任意门:http://acm.hdu.edu.cn/showproblem.php?pid=3292 No more tricks, Mr Nanguo Time Limit: 3000/1000 M ...

随机推荐

  1. ES6学习之箭头函数

    ES6学习笔记--箭头函数 箭头函数一直在用,最近突然想到重新看一下箭头函数的用法,所以这里做一些总结. 箭头函数长这个样子: let fn = a => a++; // fn 是函数名, a= ...

  2. 清瘦的记录者: 一个比dbutils更小巧、好用的的持久化工具

    https://gitee.com/bitprince/memory 1. 概述 1.1 连接.语句和结果集 从JDBC的规范上看,其对数据访问层有相当简洁的抽象:1.连接(connection) 2 ...

  3. lnmp环境搭建后续-php安装

    安装PHP7: 下载# wget http://PHP.net/get/php-7.0.2.tar.gz/from/a/mirror 建议安装之前先看看安装帮助文件INSTALL 解压安装 # tar ...

  4. SSL&TLS传输层加密协议实现图解--(重要)

    一.SSL&TLS 1.SSL:Secure Sockets Layer ,加密套接字协议层 1)SSL是为网络通信提供安全及数据完整性的一种安全协议,在传输层对网络连接进行加密 Secure ...

  5. ats 与 https

    一些证书相关的描述:   https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKe ...

  6. jenkins配置邮件通知

    参考: https://www.cnblogs.com/imyalost/p/8781759.html 谢谢大佬~

  7. vc++6.0创建console32之.c的应用程序详解

    文件-->新建-->win32-->取一个名字,确定 文件-->新建-->c++Source-->取一个名字,记住以.c为后缀,确定 编写简单的程序调试

  8. .net 学习视频

    http://www.iqiyi.com/a_19rrh9jx9p.html http://www.cnblogs.com/aarond/p/SQLDispatcher.html  --读写分离 ht ...

  9. zabbix4.0搭建(基于CentOS6.8)

    环境 服务端:188.188.3.241,系统:centos6.8,mysql:5.7.3,php:5.4.9,nginx:1.12.0   一.nginx编译安装 NGINX_VERSION=1.1 ...

  10. linux - 运维软件saltstack

    目录 运维软件saltstack 安装使用流程 运维软件saltstack 早期运维人员会根据自己的生产环境来写特定脚本完成大量重复性工作,这些脚本复杂且难以维护.系统管理员面临的问题主要是1.系统配 ...