Submission #14555606


Source Code Expand

Copy
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

def main(N):
    A = [1]
    for _ in range(100):
        A.append(A[-1] * 26)
    for n in range(1, 100):
        # n 文字のは全て使い終わった
        if N > A[n]:
            N -= A[n]
            continue
        # n 文字の中で勝負をつける
        N -= 1
        ret = []
        for _ in range(n):
            N, r = divmod(N, 26)
            ret.append(r)
        break
    ret = [chr(ord('a') + x) for x in ret]
    return ''.join(reversed(ret))

print(main(N))

Submission Info

Submission Time
Task C - One Quadrillion and One Dalmatians
User maspy
Language Python (3.8.2)
Score 300
Code Size 652 Byte
Status
Exec Time 30 ms
Memory 9108 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt
All 300 / 300 sample1.txt, sample2.txt, sample3.txt, test1.txt, test10.txt, test11.txt, test12.txt, test13.txt, test14.txt, test15.txt, test16.txt, test17.txt, test18.txt, test19.txt, test2.txt, test20.txt, test21.txt, test22.txt, test23.txt, test24.txt, test25.txt, test26.txt, test3.txt, test4.txt, test5.txt, test6.txt, test7.txt, test8.txt, test9.txt
Case Name Status Exec Time Memory
sample1.txt 23 ms 9088 KB
sample2.txt 24 ms 9020 KB
sample3.txt 21 ms 9016 KB
test1.txt 23 ms 8844 KB
test10.txt 27 ms 9088 KB
test11.txt 27 ms 8776 KB
test12.txt 28 ms 8748 KB
test13.txt 21 ms 8756 KB
test14.txt 21 ms 8956 KB
test15.txt 30 ms 8756 KB
test16.txt 26 ms 8756 KB
test17.txt 27 ms 8956 KB
test18.txt 22 ms 8960 KB
test19.txt 26 ms 8764 KB
test2.txt 22 ms 9084 KB
test20.txt 26 ms 8752 KB
test21.txt 22 ms 8968 KB
test22.txt 21 ms 8936 KB
test23.txt 22 ms 9108 KB
test24.txt 21 ms 8756 KB
test25.txt 27 ms 8760 KB
test26.txt 29 ms 8756 KB
test3.txt 27 ms 8772 KB
test4.txt 22 ms 8844 KB
test5.txt 26 ms 9076 KB
test6.txt 20 ms 9012 KB
test7.txt 27 ms 9008 KB
test8.txt 24 ms 8880 KB
test9.txt 27 ms 8764 KB