結果

問題 No.600 かい文回
ユーザー titia
提出日時 2024-08-08 02:46:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-08-08 02:46:42
合計ジャッジ時間 2,160 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def calc(N,x):
    #print(N,x)
    if N==0:
        return []
    if N==1:
        return [x]
    if N%2==1:
        return [x]+calc(N-1,x+1)

    two=0
    k=N
    while k%2==0:
        two+=1
        k//=2

    if k==1:
        return [x]*(two)
    else:
        return [x]*(two+1)+calc(k-1,x+1)

#print(calc(25,1))

N=int(input())
if N==1:
    print("a")
else:

    ANS=calc(N,1)

    ANS=ANS+ANS[::-1]

    for i in range(len(ANS)):
        ANS[i]=chr(ANS[i]%26+97)

    print("".join(ANS))
0