結果

問題 No.1152 10億ゲーム
ユーザー vwxyzvwxyz
提出日時 2023-12-21 00:09:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 26,376 KB
平均クエリ数 24.08
最終ジャッジ日時 2023-12-21 00:10:08
合計ジャッジ時間 9,520 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
26,120 KB
testcase_01 AC 116 ms
26,120 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 112 ms
26,120 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 113 ms
26,120 KB
testcase_09 AC 115 ms
26,120 KB
testcase_10 AC 118 ms
26,120 KB
testcase_11 AC 113 ms
26,120 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 108 ms
26,120 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 108 ms
26,120 KB
testcase_21 AC 114 ms
26,120 KB
testcase_22 AC 109 ms
26,120 KB
testcase_23 AC 113 ms
26,120 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 111 ms
26,120 KB
testcase_39 AC 111 ms
26,120 KB
testcase_40 AC 111 ms
26,120 KB
testcase_41 AC 114 ms
26,120 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 111 ms
26,120 KB
testcase_47 AC 110 ms
26,120 KB
testcase_48 AC 110 ms
26,120 KB
testcase_49 AC 112 ms
26,120 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())
for _ in range(35):
    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
        elif c12>c22:
            x1//=2
    else:
        if c15<c25:
            x1*=5
        elif c15>c25:
            x1//=5
    print(x1)
    if x1==x2:
        exit()
    x2=int(input())
    
0