結果

問題 No.1152 10億ゲーム
ユーザー vwxyzvwxyz
提出日時 2023-12-21 03:21:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 1,620 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 28,128 KB
平均クエリ数 27.28
最終ジャッジ日時 2024-09-27 10:43:49
合計ジャッジ時間 8,874 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34 RE * 16
権限があれば一括ダウンロードができます

ソースコード

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==0:
x1=10**9
print(x1)
if x1==x2:
exit()
x2=int(input())
if x1==x2:
exit()
else:
if abs(c12-c22)+abs(c15-c25)==1:
x1=x2
print(x1)
if x1==x2:
exit()
x1*=2
print(x1)
if x1==x2:
exit()
x2=int(input())
if x1==x2:
exit()
x1*=2
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())
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0