結果

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

ソースコード

diff #

# please use positive value
def convertDecimal(
            num, \
            decimal, \
            characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", \
            lowercharacter=False \
    ):
    
    # decimal only can use 2 to 36
    if num <= 0 and not 2 <= decimal <= 36:
        return None

    ret = ""
    while num > 0:
        ret = characters[num % decimal] + ret
        num //= decimal
    return ret

def solve(num):
    cnt = 1
    while num > 26 ** cnt:
        num -= 26 ** cnt
        cnt += 1
    return convertDecimal(num, 26, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

if __name__=="__main__":
    print(solve(int(input())))
0