結果
| 問題 | No.550 夏休みの思い出(1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-30 09:58:25 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 542 bytes |
| 記録 | |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 78,952 KB |
| 最終ジャッジ日時 | 2024-10-10 22:28:49 |
| 合計ジャッジ時間 | 7,015 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 54 |
コンパイルメッセージ
Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i); end
def scan; gets.to_i; end
aa,bb,cc = ascan
@a=aa
@b=bb
@c=cc
def calc(x)
x*x*x+@a*x*x+@b*x+@c
end
def divc(x)
3*x*x+2*@a*x+@b
end
def newton(x)
x = Rational(x)
200.times{
return 0 if divc(x) == 0
x = x-calc(x)/divc(x)
}
x.round
end
li = []
while li.size<3
x0 = rand((-1e9.to_i)..(1e9.to_i))
x0 = rand((li[0]+1)...(li[1])) if li.size == 2 && rand(50) == 0
z = newton(x0)
next unless calc(z) == 0
li << z
li.sort!.uniq!
end
puts li*" "