結果
問題 |
No.153 石の山
|
ユーザー |
![]() |
提出日時 | 2020-09-13 13:21:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-12 02:44:00 |
合計ジャッジ時間 | 2,097 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines n=int(readline()) dp=[0]*(n+1) for i in range(2, n+1): st=set() if i%2==0: st.add(0) else: st.add(dp[i//2]^dp[i//2+1]) if i%3==0 or i%3==2: st.add(dp[i//3]) else: st.add(dp[i//3+1]) for x in range(3): if x not in st: dp[i]=x break if dp[n]: print('A') else: print('B')