結果
| 問題 |
No.1179 Quadratic Equation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-21 22:43:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 226 bytes |
| コンパイル時間 | 44 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-10-15 06:02:48 |
| 合計ジャッジ時間 | 1,962 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
コンパイルメッセージ
Main.rb:8: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
a,b,c = gets.split.map(&:to_i)
d = b**2 - 4*a*c
if d < 0
puts "imaginary"
exit
end
if d == 0
puts -b/(2 * a.to_f)
exit
end
r = [(-b - d**0.5) / (2 * a.to_f), (-b + d**0.5) / (2 * a.to_f)]
puts r.sort.join(" ")