結果

問題 No.3112 Decrement or Mod Game
ユーザー hirayuu_yc
提出日時 2025-04-18 20:35:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 81,908 KB
実行使用メモリ 79,756 KB
最終ジャッジ日時 2025-04-18 20:35:41
合計ジャッジ時間 18,978 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import cache

def calc(x,y):
    if x==0:
        return 1
    se=set()
    if x-1==0:
        return 1
    if x%y==0:
        return 1
    se.add(calc(y,x-1))
    if x%y<x:
        se.add(calc(y,x%y))
    if 0 in se:
        return 1
    return 0

N=50
dp=[[0]*N for i in range(N)]
for i in range(N):
    for j in range(1,N):
        dp[i][j]=calc(i,j)
A,B=map(int,input().split())
if A==1 or B==1:
    print("Alice")
elif A==B:
    print("Alice")
elif A-B>=2:
    print("Alice")
else:
    print("Bob")

"""
for i in dp:
    print(i)
"""
0