結果

問題 No.3299 K-th MMA String
ユーザー timi
提出日時 2025-10-05 17:59:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 81,492 KB
最終ジャッジ日時 2025-10-05 17:59:26
合計ジャッジ時間 3,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())

nex=0
while K:
  nex+=1 
  s=bin(nex)
  if '110' in bin(nex):
    K-=1 
S=bin(nex)[2:]

ans=[]
for i in range(N-len(S)):
  ans.append('A')
for s in S:
  if s=='0':
    ans.append('A')
  else:
    ans.append('M')
print(''.join(ans))

0