結果

問題 No.955 ax^2+bx+c=0
ユーザー mfbgjsczmfbgjscz
提出日時 2020-05-26 03:43:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 2,175 bytes
コンパイル時間 2,096 ms
コンパイル使用メモリ 172,560 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 04:04:41
合計ジャッジ時間 7,857 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
6,816 KB
testcase_01 AC 34 ms
6,940 KB
testcase_02 AC 31 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 87 ms
6,944 KB
testcase_25 AC 90 ms
6,940 KB
testcase_26 AC 45 ms
6,940 KB
testcase_27 AC 45 ms
6,940 KB
testcase_28 AC 90 ms
6,940 KB
testcase_29 AC 89 ms
6,940 KB
testcase_30 AC 90 ms
6,940 KB
testcase_31 AC 88 ms
6,940 KB
testcase_32 AC 45 ms
6,944 KB
testcase_33 AC 45 ms
6,944 KB
testcase_34 AC 31 ms
6,944 KB
testcase_35 AC 33 ms
6,944 KB
testcase_36 AC 32 ms
6,944 KB
testcase_37 AC 31 ms
6,940 KB
testcase_38 AC 31 ms
6,944 KB
testcase_39 AC 32 ms
6,940 KB
testcase_40 AC 34 ms
6,944 KB
testcase_41 AC 34 ms
6,940 KB
testcase_42 AC 34 ms
6,940 KB
testcase_43 AC 32 ms
6,940 KB
testcase_44 AC 32 ms
6,940 KB
testcase_45 AC 33 ms
6,940 KB
testcase_46 AC 34 ms
6,940 KB
testcase_47 AC 33 ms
6,940 KB
testcase_48 AC 33 ms
6,944 KB
testcase_49 AC 35 ms
6,944 KB
testcase_50 AC 33 ms
6,940 KB
testcase_51 AC 34 ms
6,944 KB
testcase_52 AC 33 ms
6,944 KB
testcase_53 AC 33 ms
6,944 KB
testcase_54 AC 33 ms
6,944 KB
testcase_55 AC 32 ms
6,940 KB
testcase_56 AC 33 ms
6,944 KB
testcase_57 AC 33 ms
6,944 KB
testcase_58 AC 32 ms
6,940 KB
testcase_59 AC 33 ms
6,940 KB
testcase_60 AC 33 ms
6,944 KB
testcase_61 AC 31 ms
6,944 KB
testcase_62 AC 32 ms
6,944 KB
testcase_63 AC 31 ms
6,940 KB
testcase_64 AC 36 ms
6,940 KB
testcase_65 AC 33 ms
6,944 KB
testcase_66 AC 33 ms
6,944 KB
testcase_67 AC 31 ms
6,944 KB
testcase_68 AC 35 ms
6,940 KB
testcase_69 AC 32 ms
6,940 KB
testcase_70 AC 32 ms
6,944 KB
testcase_71 AC 32 ms
6,940 KB
testcase_72 AC 33 ms
6,940 KB
testcase_73 AC 32 ms
6,944 KB
testcase_74 AC 32 ms
6,940 KB
testcase_75 AC 34 ms
6,940 KB
testcase_76 AC 35 ms
6,944 KB
testcase_77 AC 34 ms
6,944 KB
testcase_78 AC 34 ms
6,944 KB
testcase_79 AC 34 ms
6,944 KB
testcase_80 AC 35 ms
6,940 KB
testcase_81 AC 35 ms
6,940 KB
testcase_82 AC 95 ms
6,944 KB
testcase_83 AC 35 ms
6,944 KB
testcase_84 AC 34 ms
6,944 KB
testcase_85 AC 33 ms
6,940 KB
testcase_86 AC 34 ms
6,944 KB
testcase_87 AC 90 ms
6,944 KB
testcase_88 AC 45 ms
6,940 KB
testcase_89 AC 92 ms
6,940 KB
testcase_90 AC 32 ms
6,940 KB
testcase_91 AC 32 ms
6,944 KB
testcase_92 AC 2 ms
6,940 KB
testcase_93 AC 2 ms
6,944 KB
testcase_94 AC 31 ms
6,940 KB
testcase_95 AC 32 ms
6,944 KB
testcase_96 AC 32 ms
6,944 KB
testcase_97 AC 32 ms
6,944 KB
testcase_98 AC 33 ms
6,944 KB
testcase_99 AC 33 ms
6,944 KB
testcase_100 AC 2 ms
6,940 KB
testcase_101 AC 32 ms
6,940 KB
testcase_102 AC 2 ms
6,944 KB
testcase_103 AC 2 ms
6,944 KB
testcase_104 AC 2 ms
6,944 KB
testcase_105 AC 2 ms
6,944 KB
testcase_106 AC 1 ms
6,940 KB
testcase_107 AC 2 ms
6,940 KB
testcase_108 AC 1 ms
6,944 KB
testcase_109 AC 2 ms
6,940 KB
testcase_110 AC 2 ms
6,940 KB
testcase_111 AC 2 ms
6,940 KB
testcase_112 AC 1 ms
6,944 KB
testcase_113 AC 2 ms
6,944 KB
testcase_114 AC 2 ms
6,944 KB
testcase_115 AC 2 ms
6,940 KB
testcase_116 AC 1 ms
6,944 KB
testcase_117 AC 1 ms
6,944 KB
testcase_118 AC 2 ms
6,940 KB
testcase_119 AC 1 ms
6,940 KB
testcase_120 AC 1 ms
6,944 KB
testcase_121 AC 1 ms
6,940 KB
testcase_122 AC 31 ms
6,940 KB
testcase_123 AC 52 ms
6,940 KB
testcase_124 AC 49 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define __float128 _Float128
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,K,N,M,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> C;
  Vec(ans,__float128,0,0.0);
  if(A==B&&B==C&&C==0){
    Out(-1);
    return 0;
  }
  else if(A!=0){
    __float128 limit=(__float128)-B/(2*A);
    __float128 eps=0.000000000001;
    __float128 ok=limit;
    __float128 ng=-pow(10,18)*9;
    Z=100000;
    while(Z--){
      __float128 mid=(ok+ng)/2.0;
      if(A>0&&A*mid*mid+B*mid+C>0)ng=mid;
      else if(A<0&&A*mid*mid+B*mid+C<0)ng=mid;
      else ok=mid;
    }
    if(A*ok*ok+B*ok+C<0.000000000001&&-0.000000000001<A*ok*ok+B*ok+C)ans.pb(ok);
    ok=limit;
    ng=pow(10,18)*9;
    Z=100000;
    while(Z--){
      __float128 mid=(ok+ng)/2.0;
      if(A>0&&A*mid*mid+B*mid+C>0)ng=mid;
      else if(A<0&&A*mid*mid+B*mid+C<0)ng=mid;
      else ok=mid;
    }
    if(A*ok*ok+B*ok+C<0.000000000001&&-0.000000000001<A*ok*ok+B*ok+C)ans.pb(ok);
  }
  else if(B!=0)ans.pb((__float128)-C/B);
  if(ans.size()==2){
    if(ans[1]-ans[0]<0.000000000001)ans.pop_back();
  }
  Out(ans.size());
  if(ans.size())for(auto v:ans)HpOut((long double)v);
}
  
0