CodeForces 630N-Forecast

素颜马尾好姑娘i 2022-08-21 02:17 130阅读 0赞

N. Forecast

time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Examples

input

  1. 1 30 200

output

  1. -10.000000000000000
  2. -20.000000000000000
  3. #include<stdio.h>
  4. #include<string.h>
  5. #include<math.h>
  6. #include<algorithm>
  7. #define LL __int64
  8. using namespace std;
  9. int main()
  10. {
  11. int a,b,c;
  12. while(scanf("%d%d%d",&a,&b,&c)!=EOF)
  13. {
  14. if(a==0)
  15. {
  16. if(b==0)
  17. {
  18. printf("0\n0\n");
  19. }
  20. else
  21. {
  22. double mm;
  23. mm=-1*(c/b);
  24. printf("%lf\n",mm);
  25. printf("%lf\n",mm);
  26. }
  27. }
  28. else
  29. {
  30. double aa,bb;
  31. aa=b*b-4*a*c;
  32. aa=sqrt(aa);
  33. double ans1,ans2,cc;
  34. cc=-1*b+aa;
  35. bb=-1*b-aa;
  36. cc=cc/(2*a);
  37. bb=bb/(2*a);
  38. ans1=min(cc,bb);
  39. ans2=max(cc,bb);
  40. printf("%lf\n%lf\n",ans2,ans1);
  41. }
  42. }
  43. return 0;
  44. }

发表评论

表情:
评论列表 (有 0 条评论,130人围观)

还没有评论,来说两句吧...

相关阅读