Problem:


Score : 300 points

Problem Statement

1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:

the dogs numbered 1,2,\cdots,26 were respectively given the names a, b, ..., z;

the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names aa, ab, ac, ..., zy, zz;

the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names aaa, aab, aac, ..., zzy, zzz;

the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;

the dogs numbered 475255,475256,\cdots  were respectively given the names aaaaa, aaaab, ...;

and so on.

To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:

a, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...

Now, Roger asks you:

"What is the name for the dog numbered N?"

Constraints

N is an integer.

 1 \leq N \leq 1000000000000001

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer to Roger's question as a string consisting of lowercase English letters.

Sample Input 1

2

Sample Output 1

b

Sample Input 2

27

Sample Output 2

aa

Sample Input 3

123456789

Sample Output 3

jjddja



Sample input:
2


Sample output:
b

Submission status: Accepted

Solution code:
n = int(input())
ans=''
while(n>0):
     n -= 1
     ans += chr(ord('a')+n%26)
     n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
ans = []
if N <= 26:
    print(chr(96 + N))
else:
    while N != 0:
        val = N % 26
        if val == 0:
            val = 26
            N = N //26 - 1
        else:
            N //= 26
        ans.append(chr(96 + val))
    ans.reverse()
    print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())

ans = ''

for i in range(13):
    if n >= 26 and n%26 == 0:
        ans = 'z' + ans
        n -= 26
    else:
        ans = chr(97 -1 + n%26) + ans
        n -= n%26

    n = n //26

print(ans.replace("`", ""))

Submission status: Accepted

Solution code:
n = int(input())

ans = ""

while n > 0:
    n -= 1
    ans += chr(ord("a") + n % 26)
    n //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
char = list("abcdefghijklmnopqrstuvwxyz")
name = ""
while n > 0:
    n -= 1
    name = char[n % 26] + name
    n = n // 26
print(name)

Submission status: Accepted

Solution code:
a = int(input())
c = ''
while (a > 26):
    b = int(a) % 26
    c += chr(ord('a') + (25 if b == 0 else int(b) - 1))
    a = int(a / 26 - 1 if a % 26 == 0 else a / 26)
c += chr(ord('a') + int(a) - 1)
print(c[::-1])

Submission status: Accepted

Solution code:
import string
N = int(input())
strings = string.ascii_lowercase
ans = ""

index = 26
cnt = 1
# Nがcnt文字で表される場合、cnt-1文字までの場合の数を引く.
while N > index:
    N -= index
    index *= 26
    cnt += 1

N -= 1
for _ in range(cnt):
    M = N % 26
    ans += strings[M]
    N //= 26


# print(ans[::-1].rjust(cnt,'a'))
print(ans[::-1].rjust(cnt,'a'))

Submission status: Accepted

Solution code:
import string
low = string.ascii_lowercase
#print(low)
N = int(input())
st = ''
while N != 0:
    rem = N%26
    if rem == 0:
        rem = 26
    N -= rem
    N = N//26
    st += low[rem-1]
    #print(rem)
print(st[::-1])

Submission status: Accepted

Solution code:
chars = [chr(i) for i in range(ord('a'), ord('z') + 1)]

arr = []

x = int(input())


def get_len(n):
    length = 1
    t = 26

    while True:
        if n <= t:
            return length
        t += 26 ** (length + 1)
        length += 1

        if length > 1000000000000001:
            raise


def get_ord(n):
    st = 1
    end = 26
    ind = 1
    while True:
        if st <= n <= end:
            return x - st

        st = end + 1
        end += 26 ** (ind + 1)
        ind += 1


length = get_len(x)
order = get_ord(x)
# print(length)

for i in range(length):
    s = order % 26
    order = order // 26
    arr.append(s)

# print(arr)

ans = ""
for ai in arr[::-1]:
    ans += chars[ai]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

alp = "abcdefghijklmnopqrstuvwxyzz"
ans = ""

while(N != 0):
    a = (N % 26)
    ans = alp[a-1] + ans

    if a != 0:
        N = int((N-a)/26)
    else:
        if N == 26 : break
        N = int((N-26)/26)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = ""
while N>0:
    N -= 1
    ans += chr(ord("a") + N % 26)
    N //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input()) - 1

def solve():
    ans = ''
    res = N
    q = 26
    while q > 0:
        q, r = divmod(res, 26)
        res = q-1
        ans = chr(ord('a') + r) + ans
    return ans

if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
n = ini()
b = ''
while n > 0:
        n -= 1
        b += chr(ord('a') + n%26)
        n = n//26
print(b[::-1])

Submission status: Accepted

Solution code:
n=int(input())

abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = ''
while n:
    ans += abc[(n-1)%len(abc)]
    n = (n-1)//len(abc)
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
for D in range(1, 10000000):
  if N <= 26 ** D:
    break
  N -= 26 ** D
#print(N)
N -= 1

ans = []
for d in range(D):
  ans.append(chr(ord('a') + N % 26))
  N //= 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)

print(num2alpha(int(input())))

Submission status: Accepted

Solution code:
chars = [chr(i) for i in range(ord('a'), ord('z') + 1)]

arr = []

x = int(input())

while True:
    s = x % 26
    arr.append(s)

    t = (x - 1) // 26
    # print("s,t", s, t)
    if t == 0:
        break
    x = t

# print('arr', arr)

ans = ""
for t in arr:
    if t == 0:
        ans += 'z'
    else:
        ans += chars[t - 1]

ans = ans[::-1]
print(ans)

Submission status: Accepted

Solution code:
s = []


def name(n):
    n -= 1
    s.append(chr(n % 26 + 97))
    if n // 26 != 0:
        name(n // 26)
    return s[::-1]


print(*name(int(input())), sep="")

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
while n > 0:
    n -= 1
    ans += chr(ord("a") + n % 26)
    n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
tmp = 2 
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = deque()
len1 = 0
for i in range(1,100):
    if (n <= 26 ** i):
        len1 = i
        break
    else:
        n = n - 26**i

n = n -1
for i in range(len1):
    tmp = n % 26
    ans.appendleft(alpha[tmp])
    n = int(n / 26)


for i in range(len(ans)):
    print(ans.popleft(),end ="")

Submission status: Accepted

Solution code:
alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

n = int(input())

str = ''
count = 0
while True:
  n -= 26 ** count
  if n < 26 ** (count + 1):
    while count != 0:
      mod = 26 ** count
      num_1 = n // mod
      n %= mod
      str = str + alph[num_1]
      count -= 1
    break
  count += 1
str = str + alph[n]
print(str)

Submission status: Accepted

Solution code:
n=int(input())

ans = ''
while n:
    tmp = (n-1)%26
    ans += chr(ord('a')+tmp)
    n-=1
    n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())

    ans = ''
    while N > 0:
        N -= 1
        ans += chr(ord("a") + N % 26)
        N = N // 26
    print(ans[::-1])

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
alp_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []
 
for i in range(1,12):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans.append(alp_list[N % 26])
      N  = N // 26
    break
  else:
    N -= 26 ** i
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
alp_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []
 
for i in range(1,12):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += alp_list[N % 26]
      N  = N // 26
    break
  else:
    N -= 26 ** i
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input()) - 1
s = ''

M = 0
for i in range(1, 1000000):
    M += 26 ** i
    if M > N:
        break

N -= (M - 26**i)

for j in reversed(range(i)):
    K = N // (26 ** j)
    s += chr(K + 97)
    N -= K * (26 ** j)

print(s)

Submission status: Accepted

Solution code:
# abc171_c.py
# https://atcoder.jp/contests/abc171/tasks/abc171_c

# C - One Quadrillion and One Dalmatians /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# ロジャーは、彼のもとに突如現れた 1000000000000001匹の犬をすべて飼うことを決意しました。
# 犬たちにはもともと 1 から 1000000000000001までの番号がふられていましたが、ロジャーは彼らに以下のルールで名前を授けました。
#     1,2,⋯,26番の番号がついた犬はその順に a,b,...,z と命名されます。
#     27,28,29,⋯,701,702番の番号がついた犬はその順に aa,ab,ac,...,zy,zz と命名されます。
#     703,704,705,⋯,18277,18278番の番号がついた犬はその順に aaa,aab,aac,...,zzy,zzz と命名されます。
#     18279,18280,18281,⋯,475253,475254番の番号がついた犬はその順に aaaa,aaab,aaac,...,zzzy,zzzz と命名されます。
#     475255,475256,⋯    番の番号がついた犬はその順に aaaaa,aaaab,... と命名されます。
#     (以下省略)

# つまり、ロジャーが授けた名前を番号順に並べると:
# a,b,...,z,aa,ab,...,az,ba,bb,...,bz,...,za,zb,...,zz,aaa,aab,...,aaz,aba,abb,...,abz,...,zzz,aaaa,... 
# のようになります。
# ロジャーはあなたに問題を出しました。
# 「番号 Nの犬の名前を答えよ。」

# 制約
#     Nは整数
#     1≤N≤1000000000000001

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N

# 出力
# ロジャーの問題に対する答えを、英小文字のみからなる文字列として出力せよ。

# 入力例 1
# 2

# 出力例 1
# b

# 入力例 2
# 27

# 出力例 2
# aa

# 入力例 3
# 123456789

# 出力例 3
# jjddja


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    alp = 'abcdefghijklmnopqrstuvwxyz'

    # １起点なので一つずらす
    q = N - 1
    result = ''

    # 下１桁ずつ加算
    while True:
        q, mod = divmod(q, 26)
        result = alp[mod] + result
        if q == 0:
            return [result]
        q -= 1

    return ['error']


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2']
        lines_export = ['b']
    if pattern == 2:
        lines_input = ['27']
        lines_export = ['aa']
    if pattern == 3:
        lines_input = ['123456789']
        lines_export = ['jjddja']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
c = list('abcdefghijklmnopqrstuvwxyz')

ans = []
def calc(k):   
    if k == 0:
        return ''
    else:
        k -= 1
        return calc(k // 26) + c[k % 26]

print(calc(n))

Submission status: Accepted

Solution code:
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1
 
pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))
 
ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
for i in range(1, 99):
    if n <= 26 ** i:
        n -= 1
        for j in range(i):
            ans += chr(ord('a') + n % 26)
            n //= 26
        break
    else:
        n -= 26 ** i
print(ans[::-1])

Submission status: Accepted

Solution code:
from string import ascii_lowercase
N = int(input())

k = [0, 26]
for i in range(1, 13):
    k.append(26 * (k[i] + 1))

for i in range(13):
    if k[i] + 1 <= N <= k[i+1]:
        n = N - (k[i] + 1)

        for j in range(i, -1, -1):
            print(ascii_lowercase[(n//26**j) % 26], end="")

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return int(X % n)


def main():
    n = int(input())
    alphabets = list(chr(i)for i in range(97, 123))
    ans = ''
    while n != 0:
        n -= 1
        ans += alphabets[n % 26]
        n //= 26
    print(ans[::-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import string
n = int(input())
s = string.ascii_lowercase
ans = ''
while n != 0:
    n -= 1
    ans += s[n%26]
    n = n // 26
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = ""

while n != 0:
    n -= 1
    ans += chr(ord('a') + n%26)
    n //= 26
    
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
ans = ''

for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
            
        break
        
    else:
        N -= 26 ** i

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else :
        N -= 26 ** i
        
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
ans=''

for i in range(1, 99):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += chr(ord('a') + N % 26)
      N //= 26
    break
  else:
    N -= 26 ** i

print(ans[::-1]) # reversed

Submission status: Accepted

Solution code:
N = int(input())
s = ""
while N != 0:
    N -= 1
    r = N % 26
    s += chr(ord('a') + r)
    N //= 26

print(s[::-1])

Submission status: Accepted

Solution code:
def conv(N):
    ans = []
    while True:
        n = N % 26 if N % 26 != 0 else 26
        alph = chr(96 + n)
        ans.append(alph)
        N = int((N-n)/26)
        if N == 0:
            break
    return "".join(ans[::-1])


if __name__ == "__main__":
    n = int(input())
    print(conv(n))

Submission status: Accepted

Solution code:

N = int(input())
N -= 1
ans = ""
while N >= 26:
    ans += chr(ord("a") + N % 26)
    N //= 26
    N -= 1
ans += chr(ord("a") + N % 26)
print(ans[::-1])

Submission status: Accepted

Solution code:
N=int(input())
ans=""
while N>0:
  N-=1
  ans+=chr(ord("a")+N%26)
  N//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    v = []
    while N:
        N -= 1
        v.append(N % 26)
        N //= 26
        if N == 0:
            break

    ans = ""
    for x in v:
        ans += chr(ord('a') + x)
    print(ans[::-1])


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1

pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))

ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])

Submission status: Accepted

Solution code:
s='abcdefghijklmnopqrstuvwxyz'
n=int(input())
def number_of_alphabets(n):
    i=1
    g=0
    while g<n:
        g+=26**i
        i+=1
    return(i-1)
def what(num):
    g=0
    for i in range(num):
        g+=26**i
    return g
num=number_of_alphabets(n)
name=['a']*num
x=what(num)
n-=x
num-=1
for i in range(num,-1,-1):
    o=n//26**i
    name[num-i]=s[o]
    n=n-o*26**i
print(''.join(name))

Submission status: Accepted

Solution code:
N = int(input())
alp_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = ''

for i in range(1,99):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += alp_list[N % 26]
      N  = N // 26
    break
  else:
    N -= 26 ** i
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

n = N
ans = ''
while True:
    n, x = divmod(n, 26)
    if x == 0:
        if n == 0:
            break
        else:
            x = 26
            n -= 1
    ans = chr(x + 97 - 1) + ans

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
i=0
j=1
l=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
S=""
while i<N:
    i+=26**j
    j+=1
N-=i-26**(j-1)
if N==26**(j-1):
    print("z"*(j-1))
    exit()
for i in reversed(range(j-1)):
    if i!=0:
        a=N//26**i
        S+=l[a]
        N-=a*(26**i)
    else:
        S+=l[N-1]
    if N==0:
        S=S[:len(S)-1]
        S+=l[a-1]
        S+="z"*i
        break
print(S)

Submission status: Accepted

Solution code:
from string import ascii_lowercase

def main():
    N=int(input())
    alphabet = ascii_lowercase
    ans = ''
    while N>0:
        N -= 1
        ans += alphabet[N%26]
        N//=26
    print(ans[::-1])

main()

Submission status: Accepted

Solution code:
from sys import stdin
import sys

n = int(stdin.readline().rstrip())

s = ""
alp = "abcdefghijklmnopqrstuvwxyz"
b = n
while True:
    a = b % 26
    b = (b-1) // 26

    if a != 0:
        s = alp[a-1] + s
    else:
        s = "z" + s

    if b == 0: break

print(s)

Submission status: Accepted

Solution code:
from itertools import count
from string import ascii_lowercase

N = int(input())
N -= 1

name = ''
for i in count(1):
    if N < 0:
        break
    else:
        name = ascii_lowercase[N % 26] + name
        N = N // 26 - 1

print(name)

Submission status: Accepted

Solution code:
# One Quadrillion and One Dalmetians

N = int(input())

Q = [N]
R = []
name =[]
i = 0

while Q[i] != 0:
    if Q[i] % 26 == 0:
        Q.append(Q[i] // 26 - 1)
    else:
        Q.append(Q[i] // 26)
    R.append((Q[i]-1) % 26 + 1)
    i += 1



while i != 0 :
    i -= 1
    name.append(chr(R[i]+96))

print(''.join(name))

Submission status: Accepted

Solution code:
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

n=int(input())
print(str.lower(num2alpha(n)))

Submission status: Accepted

Solution code:
n = int(input())
chrs = "abcdefghijklmnopqrstuvwxyz"
ans = ""
while n > 0:
    rest = n%26
    if rest%26 == 0:
        rest = 26
    ans += chrs[rest-1]
    n -= rest
    n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
def Convert(n):
    if n <= 26:
        return chr(n+96)
    elif n % 26 == 0:
        return Convert(n//26 - 1) + chr(122)
    else:
        return Convert(n//26) + chr(n%26+96)


N = int(input())
print(Convert(N))

Submission status: Accepted

Solution code:
import bisect
import string
N=int(input())

s=string.ascii_lowercase

k=1
lis=[0]
for i in range(11):
    k*=26
    lis.append(k+lis[-1])
#print(lis)

keta=bisect.bisect(lis, N-1)
#print(keta,N-lis[keta-1])

ans=''
n=N-lis[keta-1]-1
for i in range(keta):
    q,m=divmod(n,26)
    #print(q,m)
    n=q
    ans+=s[m]
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
A = ['z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
B = []
while N != 0:
        B.append(A[N % 26])
        if N % 26 != 0:
            N //= 26
        elif N % 26 == 0:
            N //= 26
            N -= 1

B.reverse()
C = ''
for i in range(len(B)):
    C += B[i]
print(C)

Submission status: Accepted

Solution code:
def num2alpha(num):
    if num <= 26:
        return chr(64 + num).lower()
    elif num % 26 == 0:
        return num2alpha(num // 26 - 1) + chr(90).lower()
    else:
        return num2alpha(num // 26) + chr(64 + num % 26).lower()


n = int(input())
print(num2alpha(n))

Submission status: Accepted

Solution code:
from bisect import bisect_left
n = int(input())
ans_list = []
flag = True
while flag:
    if n % 26 == 0:
        ans_list.append(26)
        n //= 26
        n -= 1
    else:
        ans_list.append(n % 26)
        n //= 26
    if n == 0:
        flag = False

ans_list = ans_list[::-1]
str_list = []
for x in ans_list:
    str_list.append(chr(x + 96))

print(''.join(str_list))

Submission status: Accepted

Solution code:
n = int(input())
s = ""
while n:
    n -= 1
    s = chr(n % 26 + ord("a")) + s
    n //= 26
print(s)

Submission status: Accepted

Solution code:
n = int(input())
s = ""
while n:
    n -= 1
    s = "".join([chr(n % 26 + ord("a")), s])
    n //= 26
print(s)

Submission status: Accepted

Solution code:
n = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

# 名前の長さを求める
min_n = 0
max_n = 26
l = 0
while min_n < n <= max_n:
    min_n += max_n
    max_n += max_n * 26
    l += 1

# n - min_n 番目の名前を求める <=> n - min_n - 1 を26進数に変換
m = n - min_n - 1
ans = ''
while m >= 26:
    ans = alp[m % 26] + ans
    m = m // 26 - 1
ans = alp[m] + ans

while len(ans) < l:
    ans = 'a' + ans

print(ans)

Submission status: Accepted

Solution code:
import math
import sys
readline = sys.stdin.readline


def main():
    alpha = 'abcdefghijklmnopqrstuvwxyz'
    n = int(readline().rstrip())
    arr = []
    a = n
    for i in range(100):
        if a % 26 == 0:
            b = a // 26 - 1
            c = 26
        else:
            b = a // 26
            c = a % 26
        a = b
        arr.insert(0, c)

        if b == 0:
            break

    string = ''
    for l in range(len(arr)):
        string += alpha[arr[l] - 1]
    print(string)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans  = ""
    while n != 0:
        n -= 1
        ans += chr(ord('a') + n % 26)
        n //= 26
    print(ans[::-1])

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
alp = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
name = ''
while n != 0:
    name += alp[(n-1) % 26]
    n = (n-1) // 26
print(name[::-1])

Submission status: Accepted

Solution code:
n = int(input())
syou = n
n26 = []
while syou:
  amari = syou % 26
  syou = syou // 26
  n26.append(amari)
for i in range(len(n26)):
  if n26[i] <= 0:
    if i == len(n26)-1:
      n26.pop()
      break
    n26[i] += 26
    n26[i+1] -= 1
answer = ""
for i in range(len(n26)-1, -1, -1):
  answer += chr(n26[i]+96)
print(answer)

Submission status: Accepted

Solution code:
alpa = 'zabcdefghijklmnopqrstuvwxy'
N = int(input())
# for i in range(703, 730):
#     print((i-1)//26, i)
ans = []
while N >= 27:
    ans.append(alpa[N%26])
    N = (N-1)//26

ans.append(alpa[N%26])
ans.reverse()
print(*ans, sep='')

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    N = int(input())

    ans = ""
    while N > 0:
        N -= 1
        ans += chr(ord('a') + N % 26)
        N //= 26
    
    print(ans[::-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
while n > 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
name = []

while(n != 0):
    a = n % 26
    if a == 0:
        a = 26
    name.append(chr(96+a))
    n = (n-a) // 26

name.reverse()
print(''.join(name))

Submission status: Accepted

Solution code:
n=int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
def get_digit_num(num):
    num -= 1
    if num < 26:
        return 1,num
    prev_last,digit_num = 25,2
    while True:
        if (prev_last < num < prev_last + (26 ** digit_num) + 1):
            num -= prev_last + 1
            break
        prev_last = prev_last + (26 ** digit_num)
        digit_num += 1
    return digit_num,num

def get_word(digit_num,num_n_digits):
    alpha_arr = [(chr(ord("a") + i)) for i in range(0,26)]
    idx_arr = [0] * digit_num
    for i in range(digit_num-1,-1,-1):
        idx_arr[i] = num_n_digits % 26
        num_n_digits = int(num_n_digits / 26)
    return "".join([alpha_arr[idx_arr[i]] for i in range(digit_num)])

    
if __name__ == "__main__":
    num = int(input())
    digit_num,num_n_digits = get_digit_num(num)
    print(get_word(digit_num,num_n_digits))

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    ans = ''
    for i in range(1, 99):
        if n <= 26 ** i:
            n -= 1
            for j in range(i):
                ans += chr(ord('a') + n % 26)
                n //= 26
            break
        else:
            n -= 26 ** i

    print(ans[::-1])

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(Decimal, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()