結果

問題 No.550 夏休みの思い出(1)
ユーザー imulanimulan
提出日時 2017-08-15 23:15:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 75,880 KB
最終ジャッジ日時 2024-04-21 12:38:06
合計ジャッジ時間 6,177 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
75,732 KB
testcase_01 AC 39 ms
58,880 KB
testcase_02 AC 32 ms
52,096 KB
testcase_03 AC 34 ms
52,608 KB
testcase_04 AC 33 ms
51,968 KB
testcase_05 AC 33 ms
52,224 KB
testcase_06 AC 31 ms
52,536 KB
testcase_07 AC 33 ms
52,588 KB
testcase_08 AC 35 ms
51,968 KB
testcase_09 AC 164 ms
75,456 KB
testcase_10 AC 155 ms
75,136 KB
testcase_11 AC 116 ms
75,308 KB
testcase_12 AC 118 ms
75,324 KB
testcase_13 AC 148 ms
75,044 KB
testcase_14 AC 146 ms
75,332 KB
testcase_15 AC 99 ms
75,372 KB
testcase_16 AC 152 ms
75,008 KB
testcase_17 AC 142 ms
75,520 KB
testcase_18 AC 144 ms
75,188 KB
testcase_19 AC 149 ms
75,472 KB
testcase_20 AC 135 ms
75,784 KB
testcase_21 AC 130 ms
75,776 KB
testcase_22 AC 37 ms
58,240 KB
testcase_23 AC 37 ms
58,496 KB
testcase_24 AC 40 ms
58,752 KB
testcase_25 AC 35 ms
58,752 KB
testcase_26 AC 36 ms
58,880 KB
testcase_27 AC 36 ms
58,496 KB
testcase_28 AC 35 ms
58,496 KB
testcase_29 AC 36 ms
58,752 KB
testcase_30 AC 34 ms
58,624 KB
testcase_31 AC 140 ms
75,136 KB
testcase_32 AC 139 ms
75,136 KB
testcase_33 AC 145 ms
75,604 KB
testcase_34 AC 144 ms
75,228 KB
testcase_35 AC 138 ms
75,504 KB
testcase_36 AC 133 ms
75,380 KB
testcase_37 AC 136 ms
75,392 KB
testcase_38 AC 135 ms
75,264 KB
testcase_39 AC 140 ms
75,252 KB
testcase_40 AC 41 ms
58,496 KB
testcase_41 AC 41 ms
58,496 KB
testcase_42 AC 39 ms
57,856 KB
testcase_43 AC 37 ms
58,752 KB
testcase_44 AC 38 ms
58,240 KB
testcase_45 AC 36 ms
58,880 KB
testcase_46 AC 37 ms
58,112 KB
testcase_47 AC 38 ms
58,624 KB
testcase_48 AC 39 ms
58,624 KB
testcase_49 AC 40 ms
58,496 KB
testcase_50 AC 39 ms
58,112 KB
testcase_51 AC 38 ms
58,496 KB
testcase_52 AC 38 ms
58,624 KB
testcase_53 AC 82 ms
75,272 KB
testcase_54 AC 84 ms
75,392 KB
testcase_55 AC 74 ms
75,520 KB
testcase_56 AC 79 ms
75,704 KB
testcase_57 AC 90 ms
75,880 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

    if p == 0:
        D = A**2 - 4*B
        sq = SQRT(D)
        q = (-A + sq) // 2
        r = (-A - sq) // 2
    else:
        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