結果
| 問題 | No.955 ax^2+bx+c=0 |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2022-09-14 02:26:57 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 308 bytes |
| 記録 | |
| コンパイル時間 | 610 ms |
| コンパイル使用メモリ | 9,088 KB |
| 実行使用メモリ | 15,232 KB |
| 最終ジャッジ日時 | 2026-05-25 05:05:09 |
| 合計ジャッジ時間 | 13,479 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 WA * 76 |
コンパイルメッセージ
Main.rb:4: warning: ambiguous first argument; put parentheses or a space even after `-` operator Syntax OK
ソースコード
A, B, C = gets.split.map(&:to_i)
if A == 0
puts -1
else
e = B ** 2 - 4 * A * C
if e == 0
puts 1
puts "%.12f" % Rational(-B, 2 * A)
elsif e < 0
puts 0
else
puts 2
puts "%.12f" % Rational(-B - Math.sqrt(e), 2 * A)
puts "%.12f" % Rational(-B + Math.sqrt(e), 2 * A)
end
end
siman