結果
| 問題 | No.955 ax^2+bx+c=0 |
| コンテスト | |
| ユーザー |
tamaron
|
| 提出日時 | 2019-12-18 14:45:34 |
| 言語 | Ruby (4.0.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 332 bytes |
| 記録 | |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 8,832 KB |
| 実行使用メモリ | 15,232 KB |
| 最終ジャッジ日時 | 2026-03-28 14:56:32 |
| 合計ジャッジ時間 | 9,607 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 56 WA * 66 |
コンパイルメッセージ
Main.rb:3: warning: ambiguous first argument; put parentheses or a space even after `-` operator Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-` operator 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)
if a==0 && b==0
puts -1
elsif a==0
puts 1
puts -c.to_f/b
else
if b*b-4*a*c<0
puts 0
elsif b*b-4*a*c==0
puts 1
puts -b.to_f/2*a
else
puts 2
puts (-b.to_f+(b*b-4*a*c)**(1/2.0))/2*a
puts (-b.to_f-(b*b-4*a*c)**(1/2.0))/2*a
end
end
tamaron