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. LAMP配置课程基础知识详解

    听了一天的课程,我本人对这个还是很感兴趣的. [root@localhost~]#     root 用户名 localhost 本地 ~  家目录 不同用户不同 #当前用户是管理员 $当前用户是普通 ...

  2. resize监听div的size变化

    具体实现分两类, ie9-10 默认支持div的resize事件,可以直接通过div.attachEvent('onresize', handler);的方式实现 其它浏览器 通过在div中添加一个内 ...

  3. PAT_A1018#Public Bike Management

    Source: PAT A1018 Public Bike Management (30 分) Description: There is a public bike service in Hangz ...

  4. sql server的 between and 日期问题

  5. padding填充与box-sizing: border-box配合使用

    不管伸缩盒还是浮动盒子,只要使用到padding,就必须使用 box-sizing: border-box;     有图片的时候,需摇与其他文字对齐的时候,在图片的外层加个:vertical-ali ...

  6. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 G. Xor

    There is a tree with nn nodes. For each node, there is an integer value a_ia​i​​, (1 \le a_i \le 1,0 ...

  7. SCU Censor

    Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text p . Her j ...

  8. [POJ1226]Substrings(后缀数组)

    传送门 给定 n 个字符串,求出现或反转后出现在每个字符串中的最长子串. 算法分析: 这题不同的地方在于要判断是否在反转后的字符串中出现.其实这并没有加大题目的难度. 只需要先将每个字符串都反过来写一 ...

  9. HyperLedger项目以及社区

    本文不涉及任何技术开发的内容,仅供你跟同学.同事吹牛B之用.就像很多牛人总爱讲历史典故一样. 一.诞生与现状 HyperLedger 诞生于2015年12月17日,HyperLedger 追寻Apac ...

  10. [poj2417]Discrete Logging_BSGS

    Discrete Logging poj-2417 题目大意:求$a^x\equiv b(mod\qquad c)$ 注释:O(分块可过) 想法:介绍一种算法BSGS(Baby-Step Giant- ...