結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-18 00:35:19 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 366 bytes |
| コンパイル時間 | 36 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-07-06 23:57:39 |
| 合計ジャッジ時間 | 11,373 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 86 WA * 36 |
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def lscan; gets.split.map(&:to_f); end
a,b,c = lscan
if a == 0
if b == 0
if c == 0
p -1
else
p 0
end
exit
end
p 1
h = -c/b
printf "%.15f\n", h
exit
end
d = b*b-4*a*c
z = -b/2/a
if d < 0
p 0
elsif d == 0
p 1
printf "%.15f\n", z
else
p 2
printf "%.15f\n", z-Math.sqrt(d)/2/a
printf "%.15f\n", z+Math.sqrt(d)/2/a
end