結果

問題 No.550 夏休みの思い出(1)
ユーザー titiatitia
提出日時 2024-03-12 01:51:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 1,049 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,900 KB
最終ジャッジ日時 2024-03-12 01:51:29
合計ジャッジ時間 20,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 396 ms
75,884 KB
testcase_01 AC 457 ms
75,492 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 34 ms
53,588 KB
testcase_04 AC 32 ms
53,588 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 32 ms
53,588 KB
testcase_07 AC 31 ms
53,588 KB
testcase_08 AC 32 ms
53,460 KB
testcase_09 AC 390 ms
75,628 KB
testcase_10 AC 363 ms
75,628 KB
testcase_11 AC 520 ms
76,420 KB
testcase_12 AC 531 ms
76,036 KB
testcase_13 AC 544 ms
76,036 KB
testcase_14 AC 446 ms
76,268 KB
testcase_15 AC 490 ms
76,420 KB
testcase_16 AC 508 ms
76,036 KB
testcase_17 AC 521 ms
76,036 KB
testcase_18 AC 478 ms
76,036 KB
testcase_19 AC 506 ms
76,036 KB
testcase_20 AC 482 ms
76,036 KB
testcase_21 AC 509 ms
76,036 KB
testcase_22 AC 150 ms
76,132 KB
testcase_23 AC 259 ms
76,260 KB
testcase_24 AC 258 ms
76,644 KB
testcase_25 AC 71 ms
75,896 KB
testcase_26 AC 75 ms
76,132 KB
testcase_27 AC 69 ms
75,748 KB
testcase_28 AC 70 ms
75,896 KB
testcase_29 AC 190 ms
76,132 KB
testcase_30 AC 109 ms
75,748 KB
testcase_31 AC 510 ms
76,420 KB
testcase_32 AC 521 ms
76,036 KB
testcase_33 AC 473 ms
76,036 KB
testcase_34 AC 489 ms
76,036 KB
testcase_35 AC 511 ms
76,420 KB
testcase_36 AC 531 ms
76,548 KB
testcase_37 AC 494 ms
76,036 KB
testcase_38 AC 480 ms
76,036 KB
testcase_39 AC 521 ms
76,420 KB
testcase_40 AC 289 ms
76,516 KB
testcase_41 AC 287 ms
76,388 KB
testcase_42 AC 236 ms
76,516 KB
testcase_43 AC 73 ms
75,896 KB
testcase_44 AC 127 ms
76,900 KB
testcase_45 AC 97 ms
76,132 KB
testcase_46 AC 103 ms
76,644 KB
testcase_47 AC 185 ms
76,260 KB
testcase_48 AC 265 ms
76,132 KB
testcase_49 AC 266 ms
75,620 KB
testcase_50 AC 289 ms
75,620 KB
testcase_51 AC 250 ms
75,748 KB
testcase_52 AC 357 ms
75,896 KB
testcase_53 AC 432 ms
76,036 KB
testcase_54 AC 440 ms
76,036 KB
testcase_55 AC 361 ms
75,896 KB
testcase_56 AC 413 ms
76,036 KB
testcase_57 AC 460 ms
76,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 割り切れる割り算、上の桁から。
def poly_div(X,Y):
    ANS=[0]*(len(X)-len(Y)+1)

    for i in range(len(X)-len(Y)+1):
        if X[i]%Y[0]!=0:
            return False
        
        ANS[i]=X[i]//Y[0]
        for j in range(len(Y)):
            X[j+i]-=ANS[i]*Y[j]

    return ANS

# 掛け算
def poly_mul(X,Y):
    ANS=[0]*(len(X)+len(Y)-1)

    for i in range(len(X)):
        for j in range(len(Y)):
            ANS[i+j]+=X[i]*Y[j]

    return ANS


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


for i in range(-10**6-5,10**6+5):
    ANS=poly_div([1,A,B,C],[1,-i])

    if ANS!=False:
        a,b,c=ANS

        if b*b-4*c<0:
            continue

        k=(-b+(b*b-4*c)**(1/2))/2
        l=(-b-(b*b-4*c)**(1/2))/2

        if abs(k-round(k))<0.00000000000001 and abs(l-round(l))<0.00000000000001:
            L=[i,round(k),round(l)]
            L.sort()

            XX=poly_mul(poly_mul([1,-i],[1,-round(k)]),[1,-round(l)])

            if XX[1:]==[A,B,C]:
                print(*L)
                exit()
                
            
0