結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
%20
|
| 提出日時 | 2019-12-18 01:52:03 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 462 bytes |
| コンパイル時間 | 125 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-07-07 00:11:39 |
| 合計ジャッジ時間 | 12,471 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 102 WA * 20 |
コンパイルメッセージ
Main.rb:18: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def h(x,y)
puts (x<0?y<0?'':?-:y<0??-:'')+(?0*100+"#{x.abs/y.abs}").sub(/.{100}$/){".#$&"}.sub(/^0*\B/){''}
end
def f(x,y)
h(x*10**100,y)
end
def g(x,y,z)
t=(0..10**200).bsearch{|t|t*t>=10**200*y.abs}
h(x*10**100+(y<0?-1:1)*t,z)
end
a,b,c=gets.split.map &:to_i
if a==0
if b==0
if c==0
p -1
else
p 0
end
else
p 1
f(-c,b)
end
else
d=b*b-4*a*c
if d>0
p 2
g(-b,-d,2*a)
g(-b,d,2*a)
elsif d==0
p 1
f(-b,2*a)
else
p 0
end
end
%20