結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-04-17 20:30:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 927 bytes |
| コンパイル時間 | 2,557 ms |
| コンパイル使用メモリ | 193,184 KB |
| 最終ジャッジ日時 | 2025-01-09 19:36:46 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 90 WA * 32 |
ソースコード
#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';
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
struct Precision{
Precision(){
cout<<fixed<<setprecision(12);
}
}precision_beet;
//INSERT ABOVE HERE
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
Int a,b,c;
cin>>a>>b>>c;
using D = long double;
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