結果

問題 No.1152 10億ゲーム
ユーザー vwxyzvwxyz
提出日時 2023-12-21 03:10:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,299 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 26,248 KB
平均クエリ数 28.42
最終ジャッジ日時 2023-12-21 03:11:05
合計ジャッジ時間 9,039 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
26,248 KB
testcase_01 AC 102 ms
26,248 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 103 ms
26,248 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 101 ms
26,248 KB
testcase_09 AC 134 ms
26,248 KB
testcase_10 AC 103 ms
26,248 KB
testcase_11 RE -
testcase_12 AC 103 ms
26,248 KB
testcase_13 AC 107 ms
26,248 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 104 ms
26,248 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 107 ms
26,248 KB
testcase_23 RE -
testcase_24 AC 110 ms
26,248 KB
testcase_25 AC 109 ms
26,248 KB
testcase_26 AC 111 ms
26,248 KB
testcase_27 AC 110 ms
26,248 KB
testcase_28 AC 102 ms
26,248 KB
testcase_29 AC 105 ms
26,248 KB
testcase_30 AC 104 ms
26,248 KB
testcase_31 AC 103 ms
26,248 KB
testcase_32 AC 104 ms
26,248 KB
testcase_33 AC 103 ms
26,248 KB
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 AC 133 ms
26,248 KB
testcase_43 AC 103 ms
26,248 KB
testcase_44 AC 105 ms
26,248 KB
testcase_45 AC 105 ms
26,248 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 AC 103 ms
26,248 KB
testcase_49 AC 103 ms
26,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def x_to_cnt(x):
    cnt2,cnt5=0,0
    while x%2==0:
        x//=2
        cnt2+=1
    while x%5==0:
        x//=5
        cnt5+=1
    return cnt2,cnt5
def cnt_to_x(cnt2,cnt5):
    return 2**cnt2*5**cnt5
x1,x2=map(int,input().split())
c12,c15=x_to_cnt(x1)
c22,c25=x_to_cnt(x2)
while (c12,c15)!=(7,9):
    if c12<7:
        x1*=2
        c12+=1
    elif c12>7:
        x1//=2
        c12-=1
    elif c15<9:
        x1*=5
        c15+=1
    elif c15>9:
        x1//=5
        c15-=1
    print(x1)
    if x1==x2:
        exit()
    x2=int(input())
    if x1==x2:
        exit()
assert x1==2**7*5**9
if (abs(c12-c22)+abs(c15-c25))%2==1:
    x1=10**9
    print(x1)
    if x1==x2:
        exit()
    x2=int(input())
    if x1==x2:
        exit()

while True:
    assert 10**9%x1==0
    assert 10**9%x2==0
    if x1==x2:
        exit()
    c12,c15=x_to_cnt(x1)
    c22,c25=x_to_cnt(x2)
    if abs(c12-c22)>=abs(c15-c25):
        if c12<c22:
            x1*=2
            c12+=1
        elif c12>c22:
            x1//=2
            c12-=1
        else:
            assert False
    else:
        if c15<c25:
            x1*=5
            c15+=1
        elif c15>c25:
            x1//=5
            c15-=1
        else:
            assert False
    print(x1)
    if x1==x2:
        exit()
    x2=int(input())
0