結果

問題 No.3290 Encrypt Failed, but Decrypt Succeeded
ユーザー moon17
提出日時 2025-10-03 23:07:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 113,748 KB
最終ジャッジ日時 2025-10-03 23:07:16
合計ジャッジ時間 3,586 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
t=input()
M=k+10
d=[0]*(1+n)
d[n]=1
for i in range(n)[::-1]:
  if t[i]=='0':
    continue
  if i+1>=n or t[i+1]!='0':
    d[i]+=d[i+1]
  if 10<=int(t[i:i+2])<=26:
    d[i]+=d[i+2]
  d[i]%=M
i=0
ans=[]
while i<n:
  # print(k,i,d[i+1])
  if k<=d[i+1]:
    ans+=chr(int(t[i])+ord('a')-1),
    i+=1
  else:
    ans+=chr(int(t[i:i+2])+ord('a')-1),
    k-=d[i+1]
    i+=2
print(''.join(ans))
0