結果

問題 No.327 アルファベット列
ユーザー AT274_
提出日時 2019-10-27 10:58:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-14 21:01:12
合計ジャッジ時間 3,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
alphabets = [chr(i) for i in range(ord('A'), ord('A') + 26)]

if N < 26:
    print(alphabets[N])
    exit()


def encode_x_base(n, x):
    if n == 0:
        return [0]

    ret = []
    while n:
        ret.append(n % x)
        n //= x

    return ret[::-1]


encoded_N_26_based = encode_x_base(N // 26 - 1, 26)
ans = [alphabets[i] for i in encoded_N_26_based] + [alphabets[N % 26]]
print(''.join(ans))
0