結果
| 問題 | No.955 ax^2+bx+c=0 |
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-04-17 20:50:18 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,102 bytes |
| 記録 | |
| コンパイル時間 | 6,935 ms |
| コンパイル使用メモリ | 456,072 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-09 13:42:42 |
| 合計ジャッジ時間 | 10,077 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 102 WA * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';
#include <quadmath.h>
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
struct Precision{
Precision(){
cout<<fixed<<setprecision(30);
}
}precision_beet;
//INSERT ABOVE HERE
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using D = mp::number<mp::cpp_dec_float<1024>>;
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
D a,b,c;
cin>>a>>b>>c;
if(a==0){
if(b==0 and c==0) drop(-1);
if(b==0 and c!=0) drop(0);
cout<<1<<newl;
cout<<D(-c)/D(b)<<newl;
return 0;
}
if(b*b-4*a*c<0) drop(0);
if(b*b-4*a*c==0){
cout<<1<<newl;
cout<<D(-b)/D(2*a)<<newl;
return 0;
}
cout<<2<<newl;
cout<<(D(-b)-sqrt(D(b*b-4*a*c)))/D(2*a)<<newl;
cout<<(D(-b)+sqrt(D(b*b-4*a*c)))/D(2*a)<<newl;
return 0;
}
beet