結果

問題 No.550 夏休みの思い出(1)
ユーザー 6soukiti296soukiti29
提出日時 2017-07-29 00:01:04
言語 Nim
(2.0.2)
結果
TLE  
実行時間 -
コード長 1,425 bytes
コンパイル時間 3,203 ms
コンパイル使用メモリ 70,484 KB
実行使用メモリ 11,644 KB
最終ジャッジ日時 2023-09-12 13:42:00
合計ジャッジ時間 9,953 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,math
var
    A,B,C : float64
    s,t,u : float64
    x,y,z : float64
    l,r : float64
    ans : array[3,int]
(A,B,C) = stdin.readline.split.map(parsefloat)

proc f(x: float64):float64=
    return x * x * x + A * x * x + B * x + C

proc slope(x : float64):float64=
    return 3 * x * x + 2 * A * x + B

proc s2(x : float64):float64=
    return 6 * x + 2 * A

l = -pow(10.0,9.0)
r = pow(10.0,9.0)
while slope(l) > 0.0 or slope(r) > 0.0:
    if s2((l + r) / 2) < 0:
        l = (l + r) / 2
    else:
        r = (l + r) / 2
var
    l2 = -pow(10.0,9.0).float64
    r2 = l
while abs(l2 - r2) > 0.5:
    if slope((l2 + r2) / 2) > 0.0:
        l2 = (l2 + r2) / 2
    else:
        r2 = (l2 + r2) / 2
var
    r3 = pow(10.0,9.0).float64
    l3 = r

while abs(r3 - l3) > 0.5:
    if slope((l3 + r3) / 2) > 0.0:
        r3 = (l3 + r3) / 2
    else:
        l3 = (l3 + r3) / 2
var
    l4 = -pow(10.0,9.0)
    r4 = r2
    m : float64
while f(r4) > 0.1:
    m = (l4 + r4) / 2.0
    if f(m) > 0.0:
        r4 = m
    else:
        l4 = m
ans[0] = floor(r4).int
var
    l5 = l2
    r5 = l3
while abs(f(r5)) > 0.1:
    m = (l5 + r5)
    if f(m) > 0.0:
        l5 = m
    else:
        r5 = m
ans[1] = floor(r5).int
    
var
    l6 = r3
    r6 = pow(10.0,9.0)
while abs(f(r6)) > 0.1:
    m = (l6 + r6) / 2
    if f(m) > 0.0:
        r6 = m
    else:
        l6 = m
ans[2] = floor(r6).int
echo ans.join(" ")

    
    
0