結果

問題 No.550 夏休みの思い出(1)
ユーザー 6soukiti296soukiti29
提出日時 2017-07-29 06:36:00
言語 Nim
(2.0.2)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,958 bytes
コンパイル時間 3,056 ms
コンパイル使用メモリ 69,028 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 13:43:23
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import sequtils,strutils,math,algorithm
var
    A,B,C : float64
    l,r : float64
    ans : array[3,int64]
    s,t,u : int64
(s,t,u) = stdin.readline.split.map(parseBiggestInt)
(A,B,C) = (s.float64,t.float64,u.float64)
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).float64
r = pow(10.0,9.0).float64
while slope(l) > 0.0 or slope(r) > 0.0:
    if s2((l + r) / 2) < 0.0:
        l = (l + r) / 2
    else:
        r = (l + r) / 2
var
    l2 = -pow(10.0,9.0).float64
    r2 = l
while r2 - l2 > 1:
    if slope((l2 + r2) / 2.0) > 0.0:
        l2 = (l2 + r2) / 2.0
    else:
        r2 = (l2 + r2) / 2.0
var
    r3 = pow(10.0,9.0).float64
    l3 = r

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


for a in -10..10:
    for b in -10..10:
        for c in -10..10:
            var
                x,y,z : int64
            (x,y,z) = ((ans[0] + a).int64,(ans[1] + b).int64,(ans[2] + c).int64)
            if (x * y * z == -u and
                x + y + z == -s and
                x * y + y * z + z * x == t):
                ans[0] = x
                ans[1] = y
                ans[2] = z
ans.sort(system.cmp)
echo ans.join(" ")
0