結果
| 問題 |
No.1152 10億ゲーム
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2020-08-08 00:01:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,174 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 82,308 KB |
| 実行使用メモリ | 85,060 KB |
| 平均クエリ数 | 27.94 |
| 最終ジャッジ日時 | 2024-07-17 05:23:33 |
| 合計ジャッジ時間 | 9,856 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 RE * 34 |
ソースコード
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),flush=True)
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()))
Kazun