結果

問題 No.550 夏休みの思い出(1)
ユーザー maimai
提出日時 2017-07-30 10:01:28
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 471 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 19,360 KB
最終ジャッジ日時 2024-04-19 05:52:13
合計ジャッジ時間 16,939 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
19,232 KB
testcase_01 AC 99 ms
12,544 KB
testcase_02 AC 119 ms
12,416 KB
testcase_03 AC 175 ms
12,288 KB
testcase_04 AC 161 ms
12,160 KB
testcase_05 AC 152 ms
12,160 KB
testcase_06 AC 199 ms
12,160 KB
testcase_07 AC 452 ms
12,288 KB
testcase_08 AC 96 ms
12,416 KB
testcase_09 AC 103 ms
12,288 KB
testcase_10 AC 87 ms
12,416 KB
testcase_11 AC 87 ms
12,160 KB
testcase_12 AC 89 ms
12,416 KB
testcase_13 AC 89 ms
12,288 KB
testcase_14 AC 91 ms
12,416 KB
testcase_15 AC 88 ms
12,288 KB
testcase_16 AC 86 ms
12,416 KB
testcase_17 AC 90 ms
12,288 KB
testcase_18 AC 86 ms
12,416 KB
testcase_19 AC 89 ms
12,288 KB
testcase_20 AC 87 ms
12,288 KB
testcase_21 AC 92 ms
12,288 KB
testcase_22 AC 582 ms
12,416 KB
testcase_23 AC 190 ms
12,288 KB
testcase_24 AC 352 ms
12,544 KB
testcase_25 AC 177 ms
12,288 KB
testcase_26 AC 521 ms
12,544 KB
testcase_27 AC 156 ms
12,160 KB
testcase_28 AC 98 ms
12,416 KB
testcase_29 AC 94 ms
12,160 KB
testcase_30 AC 175 ms
12,416 KB
testcase_31 AC 103 ms
12,288 KB
testcase_32 AC 95 ms
12,288 KB
testcase_33 AC 103 ms
12,160 KB
testcase_34 AC 118 ms
12,416 KB
testcase_35 AC 101 ms
12,288 KB
testcase_36 AC 125 ms
12,416 KB
testcase_37 AC 109 ms
12,160 KB
testcase_38 AC 115 ms
12,416 KB
testcase_39 AC 98 ms
12,416 KB
testcase_40 AC 407 ms
12,288 KB
testcase_41 AC 221 ms
12,288 KB
testcase_42 AC 222 ms
12,416 KB
testcase_43 AC 687 ms
12,544 KB
testcase_44 AC 129 ms
12,288 KB
testcase_45 AC 107 ms
12,416 KB
testcase_46 AC 420 ms
12,416 KB
testcase_47 AC 161 ms
12,544 KB
testcase_48 AC 385 ms
12,160 KB
testcase_49 TLE -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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 = (x).to_f
    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))
    z = newton(x0)
    next unless calc(z) == 0
    li << z
    li.sort!.uniq!
end
puts li*" "

0