結果

問題 No.1152 10億ゲーム
ユーザー 👑 KazunKazun
提出日時 2020-08-07 23:24:39
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,163 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 95,524 KB
平均クエリ数 27.94
最終ジャッジ日時 2023-09-24 05:03:31
合計ジャッジ時間 11,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
87,280 KB
testcase_01 AC 122 ms
86,472 KB
testcase_02 AC 127 ms
87,132 KB
testcase_03 AC 120 ms
86,928 KB
testcase_04 AC 121 ms
87,180 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 117 ms
87,296 KB
testcase_09 AC 116 ms
86,836 KB
testcase_10 AC 117 ms
87,156 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 122 ms
87,072 KB
testcase_15 AC 119 ms
87,116 KB
testcase_16 AC 118 ms
87,368 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 122 ms
86,696 KB
testcase_21 AC 116 ms
87,228 KB
testcase_22 AC 119 ms
87,668 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 AC 117 ms
87,180 KB
testcase_49 AC 118 ms
87,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def f(a,b):
    return (2**a)*(5**b)

def h(N):
    L=[2,5]
    X=[]

    for a in L:
        x=0
        while N%a==0:
            N//=a
            x+=1
        X.append(x)
    return X

def dist(P,Q):
    return abs(P[0]-Q[0])+abs(P[1]-Q[1])

A,B=map(int,input().split())
G=9
P,Q=h(A),h(B)

V=[(-1,0),(0,-1),(1,0),(0,1)]

if dist(P,Q)%2==0:
    S=[7,9]
    while P!=S:
        M=dist(P,S)
        Y=[-1,-1]
        for u,v in V:
            R=[P[0]+u,P[1]+v]
            if dist(R,S)<M and 0<=R[0]<=G and 0<=R[1]<=G:
                Y=[R[0],R[1]]
                M=dist(R,S)
        P=[Y[0],Y[1]]
        print(f(*P),flush=True)

        if P==Q:
            sys.exit()

        Q=h(int(input()))
        if P==Q:
            sys.exit()

    P=[9,9]
    print(f(9,9))

    if Q==[9,9]:
        sys.exit()

    Q=h(int(input()))
    if P==Q:
        sys.exit()

while P!=Q:
    M=dist(P,Q)

    Y=[-1,-1]
    for u,v in V:
        R=[P[0]+u,P[1]+v]
        if dist(R,Q)<M and 0<=R[0]<=G and 0<=R[1]<=G:
            Y=[R[0],R[1]]
            M=dist(R,Q)
    P=[Y[0],Y[1]]
    print(f(*P),flush=True)

    if P==Q:
        break

    Q=h(int(input()))
0