結果

問題 No.550 夏休みの思い出(1)
ユーザー imulanimulan
提出日時 2017-08-15 23:11:35
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
実行時間 -
コード長 594 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 8,224 KB
最終ジャッジ日時 2023-08-03 14:15:42
合計ジャッジ時間 19,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 421 ms
8,064 KB
testcase_01 AC 815 ms
7,876 KB
testcase_02 AC 16 ms
7,880 KB
testcase_03 AC 15 ms
7,992 KB
testcase_04 AC 16 ms
8,048 KB
testcase_05 AC 15 ms
8,000 KB
testcase_06 AC 15 ms
7,928 KB
testcase_07 AC 15 ms
8,004 KB
testcase_08 AC 15 ms
7,876 KB
testcase_09 AC 423 ms
8,020 KB
testcase_10 AC 424 ms
8,044 KB
testcase_11 AC 414 ms
8,024 KB
testcase_12 AC 413 ms
7,960 KB
testcase_13 AC 433 ms
7,888 KB
testcase_14 AC 419 ms
8,084 KB
testcase_15 RE -
testcase_16 AC 431 ms
7,876 KB
testcase_17 AC 416 ms
7,912 KB
testcase_18 AC 409 ms
8,008 KB
testcase_19 AC 414 ms
7,964 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 140 ms
7,876 KB
testcase_23 AC 319 ms
7,908 KB
testcase_24 AC 260 ms
7,940 KB
testcase_25 AC 38 ms
7,932 KB
testcase_26 AC 37 ms
7,924 KB
testcase_27 AC 39 ms
7,956 KB
testcase_28 AC 37 ms
8,096 KB
testcase_29 AC 168 ms
7,932 KB
testcase_30 AC 96 ms
8,052 KB
testcase_31 AC 411 ms
7,928 KB
testcase_32 AC 410 ms
7,952 KB
testcase_33 AC 415 ms
7,904 KB
testcase_34 AC 423 ms
8,060 KB
testcase_35 AC 415 ms
7,948 KB
testcase_36 AC 414 ms
8,004 KB
testcase_37 AC 421 ms
7,956 KB
testcase_38 AC 413 ms
8,020 KB
testcase_39 AC 417 ms
8,020 KB
testcase_40 AC 396 ms
7,936 KB
testcase_41 AC 407 ms
7,956 KB
testcase_42 AC 266 ms
7,940 KB
testcase_43 AC 38 ms
8,000 KB
testcase_44 AC 39 ms
7,932 KB
testcase_45 AC 39 ms
8,048 KB
testcase_46 AC 38 ms
7,872 KB
testcase_47 AC 164 ms
7,948 KB
testcase_48 AC 429 ms
7,952 KB
testcase_49 AC 354 ms
8,224 KB
testcase_50 AC 390 ms
7,948 KB
testcase_51 AC 375 ms
7,880 KB
testcase_52 AC 395 ms
7,964 KB
testcase_53 AC 433 ms
7,928 KB
testcase_54 AC 431 ms
8,092 KB
testcase_55 AC 405 ms
7,948 KB
testcase_56 AC 403 ms
7,960 KB
testcase_57 AC 426 ms
8,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = 1000000

def f(x,a,b,c):
    return x**3 + a*x**2 + b*x + c

def SQRT(n):
    l,r= 0,10**46
    while r-l>1:
        m = (l+r)//2
        if m*m <= n:
            l = m
        else:
            r = m
    return l

def main():
    A,B,C = map(int,input().split())

    p = -N+1
    while True:
        if f(p,A,B,C) == 0:
            break
        p += 1

    D = (p*B+C)**2 + 4*C*p**3
    sq = SQRT(D)

    q = (p*B+C + sq) // (2*p**2)
    r = (p*B+C - sq) // (2*p**2)

    ans = [p,q,r]
    ans.sort()
    print(' '.join(map(str,ans)))

if __name__ == '__main__':
    main()
0