結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
![]() |
提出日時 | 2020-08-21 22:04:07 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 248 bytes |
コンパイル時間 | 41 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-10-15 05:39:31 |
合計ジャッジ時間 | 1,817 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
コンパイルメッセージ
Main.rb:12: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
a,b,c = gets.split.map(&:to_i) d =b*b - 4*a*c if d< 0 then puts "imaginary" return end a= a.to_f b=b.to_f c=c.to_f if d==0 then puts -b/(2*a) return end d = Math.sqrt(d.to_f) x1 = (-b+d)/(2*a) x2 = (-b-d)/(2*a) puts "#{x2} #{x1}"