結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
|
提出日時 | 2020-08-21 22:37:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 769 bytes |
コンパイル時間 | 1,532 ms |
コンパイル使用メモリ | 166,220 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 06:00:55 |
合計ジャッジ時間 | 1,931 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define MoD 1e9 + 7 #define clear(a) memset(a, 0, sizeof(a)) #define fo(i, a, b) for(int i = a; i < b; i++) //#define re(i, a, b) for(int i = b; i > a; i--) #define pb(a) push_back(a) 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;} int a,b,c; void solve(){ cin >> a>>b>>c; int dis= (b*b)-(4*a*c); cout.precision(20); if(dis>0) cout << (-b-sqrt(dis))/(2*a) <<' '<< (-b+sqrt(dis))/(2*a) << '\n'; else if(dis==0) cout << (-b)/(2*a) << '\n'; else cout << "imaginary" << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t=1; for(int i=1; i<=t; ++i) { solve(); } }