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())

chars = 'abcdefghijklmnopqrstuvwxyz'
def to26(n):
  if n <= 0:
    return ''
  mod = 26 if n % 26 == 0 else n % 26
  if n == mod:
    return chars[mod-1]
  n = int((n - mod) / 26)
  return to26(n) + chars[mod-1]

print(to26(n))

Submission status: Accepted

Solution code:
N = int(input())
cur = N

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)

ans = num2alpha(N)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(1,15):
  count+=26**i
  if count>=n:
    keep=i
    break

for i in range(1,keep):
  n-=26**i

n-=1
lis=[]
for i in range(0,keep):
  t=keep-i-1
  one=n//(26**t)
  lis.append(one)
  n-=one*26**t

ans=""
for i in range(len(lis)):
  ans+=chr(97+lis[i])
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())
cha = "abcdefghijklmnopqrstuvwxyz"
ans = []
while n >= 1:
    mod = (n - 1) % 26
    ans.append(mod)
    n = (n - 1) // 26
    
ans_s = ''
for tmp in reversed(ans):
    ans_s += cha[tmp]
print(ans_s)

Submission status: Accepted

Solution code:
n = int(input())
cha = "abcdefghijklmnopqrstuvwxyz"
ans = ""
while n>=1:
    ans += cha[((n-1)%26)]
    n=(n-1)//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:
from collections import deque

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

def resolve():
    n = ii()
    que = deque()

    val = n
    while val != 0:
        val, m = divmod(val,26)
        if m == 0:
            val -= 1
            m = 26
        que.append(m)
    res = ""
    for i in que:
        res = chr(ord("a")+i-1) + res
    print(res)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def C():
    n = int(input())
    ret = [None]*12
    q = n
    for i in range(12):
        q,mod = divmod(q,26)
        if mod == 0:
            ret[i] = "z"
            q -= 1
        else:
            ret[i] = chr(mod+96)
        if q == 0:
            break
    ret = ret[:i+1]
    ret.reverse()
    print("".join(ret))
C()

Submission status: Accepted

Solution code:
def C():
    n = int(input())
    ret = [None]*12
    q = n
    for i in range(12):
        q,mod = divmod(q,26)
        if mod == 0:
            ret[i] = "z"
            q -= 1
        else:
            ret[i] = chr(mod+96)
        if q == 0:
            break
    ret = ret[:i+1]
    ret.reverse()
    print("".join(map(str,ret)))
C()

Submission status: Accepted

Solution code:
N = int(input())

ans = ""
while N > 0:
  x = (N-1) % 26

  ans = chr(ord('a') + x) + ans
  N = (N-1) // 26

print(ans)

Submission status: Accepted

Solution code:
import string
N = int(input())
ANS =[]
while N>0:
    M=int(N%26)
    if M==0:
        M=26
    ANS.insert(0,string.ascii_lowercase[M-1])
    N=N-M
    N=N/26
    # print(ANS)
map = map(str,ANS)
print(''.join(map))

Submission status: Accepted

Solution code:
N = int(input())

ans = ""
while N > 0:
  x = (N-1) % 26

  ans = chr(ord('a') + x) + ans
  N = (N-1) // 26
  
print(ans)

Submission status: Accepted

Solution code:
#171C
##One Quadrillion and One Dalmatians

n=int(input())
alpha=[chr(i) for i in range(ord('a'),ord('z')+1)]
ans=''
while n>0:
    n-=1
    ans=alpha[n%26]+ans
    n//=26
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = 1
s = 26
while True:
    if n <= s:
        break
    c += 1
    s += 26 ** c
a = ""
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(1,c+1):
    a += al[(n - 1) % 26]
    n = (n - 1) // 26
print(a[::-1])

Submission status: Accepted

Solution code:
n=int(input())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        if X_dumy%n!=0:
            out = str(chr(X_dumy%n+ord('a')-1))+out
            X_dumy = int(X_dumy/n)
        else:
            out = str(chr(n+ord('a')-1))+out
            X_dumy = int(X_dumy/n)-1
    return out
    
ans = Base_10_to_n(n, 26)
print(ans)

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())
 
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=[]
ANS_N=[]
 
while N != 0:
  N -= 1
  ANS.append(N%26)
  N = N // 26
 
for i in range(len(ANS)):
  ANS_N.append(ABC[ANS[i]])
 
ans = "".join(reversed(ANS_N))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans=''

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

print(ans[::-1])

Submission status: Accepted

Solution code:
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    #A, B = [int(x) for x in raw_input().split()]
    N = int(raw_input())
    
    temp = []
    
    while N > 0:
        #print(N)
        ch = ' '
        if N % 26 == 0:
            ch = 'z'
        else:
            ch = chr(ord('a') + (N % 26) - 1)
        temp.append(ch)
        N = (N - 1) // 26
    
    ans = ''.join(reversed(temp))
    
    print(ans)
    
    

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())
ans = ""
while N>0:
    N -= 1
    s = N%26
    ans += chr(s + 97)
    N = (N-s)//26
print(ans[::-1])

Submission status: Accepted

Solution code:
# C - One Quadrillion and One Dalmatians
def get_alphabet(mod):
	import string
	lower = string.ascii_lowercase
	
	if mod == 0 or mod == 26:
		return 'z'
	else:
		return lower[mod - 1]


n = int(input())

ans = ''

while n > 26:
	mod = n % 26
	s = get_alphabet(mod)
	ans = s + ans
	n //= 26
	
	if mod == 0:
		n -= 1
	
ans = get_alphabet(n) + ans
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

tmp=0
for ll in range(1,20):
  tmp+=26**ll
  if n<=tmp:
    break

s=chr((n-1)%26+ord("a")) ##一文字目
for i in range(1,ll):
  n-=26**i
  s+=chr((n-1)//(26**i)%26+ord("a")) 

print(s[::-1])

Submission status: Accepted

Solution code:
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input())
b = 26
d = 0
digs = 1
while d + b < n:
    d += b
    b *= 26
    digs += 1
n -= d + 1
ans = []
while n > 0:
    ans.append(chr(ord('a') + n % 26))
    n //= 26
while len(ans) < digs:
    ans.append('a')
print(''.join(reversed(ans)))

Submission status: Accepted

Solution code:
# C - One Quadrillion and One Dalmatians
n = int(input())
dic = dict()

import string
i = 1

for s in string.ascii_lowercase:
	dic[i % 26] = s
	i += 1	

name = ''
i = 1

while True:
	mod = n % 26
	name += dic[mod]
	
	if n > 26:
		if mod == 0:
			mod = 26
		
		n = (n - mod) // 26
		i += 1
	else:
		break

print(''.join(list(reversed(name))))

Submission status: Accepted

Solution code:
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s, n, node):
    # 頂点が探索済みかどうかのチェック配列
    check = [False for _ in range(n)]
    check[s] = True
    # 次見る頂点を格納するキュー
    queue = deque([s])
    visited_num = 1

    # 問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color = [-1 for _ in range(n)]
    color[s] = 0

    while visited_num < n:
        # グラフが全連結ではない場合
        if len(queue) == 0:
            # 空配列を返す
            # 現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex = queue.popleft()
        # インデックスがない場合は
        for next_vertex in node[now_vertex]:

            if check[next_vertex] == True:
                continue

            queue.append(next_vertex)
            check[next_vertex] = True

            # 問題固有の計算
            color[next_vertex] = color[now_vertex]+1
            visited_num += 1

    return color


mod = 10**9+7
# n=int(input())
# n,m=list(map(int,input().split()))
# a=list(map(int,input().split()))
def ceil(x, y): return (x+y-1)//y
def input_list(): return list(map(int, input().split()))


n = int(input())
n -= 1
num = 26
ans = []
while n >= num:
    k = n % num
    ans.append(k)
    n //= num
    n -= 1
ans.append(n)
# print(ans)
ans = (list(map(lambda x: chr(x+ord("a")), ans)))
print("".join(ans)[::-1])

Submission status: Accepted

Solution code:
import bisect
n = int(input())
x = [0]
while x[-1] < 1000000000000001:
    x.append(x[-1]+26**(len(x)))
d = 'abcdefghijklmnopqrstuvwxyz'
digits = bisect.bisect_left(x,n)
num = n - x[digits-1]-1
ans = ""
for i in range(digits):
    ans = ''.join([d[num%(26)],ans])
    num = num//26
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

def converter(x):
    if x <= 26:
        y = chr(x + 96)
    elif x % 26 == 0:
        y = converter(x // 26 - 1) + chr(122)
    else:
        y = converter(x // 26) + chr(x % 26 + 96)
    return y

name = converter(x)

print(name)

Submission status: Accepted

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

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:
n = int(input())
n-=1

def toa(n):
    return chr((ord('a')+n))

ans = ''
while True:
    ans+=toa(n%26)
    n = n//26 -1
    if n<0:
        break
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())

tmp = 0
i = -1
tmp_list= []
while tmp<=n:
  i+=1
  tmp+=26**i
  tmp_list.append(26**i)
n-=(tmp-tmp_list[-1])

tmp = []
while 1:
  if n<26:
    tmp.append(n%26)
    break
  tmp.append(n%26)
  n = n//26
alphabet = ["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"]

result = ""
for arg in reversed(tmp):
  result += alphabet[arg]

for _ in range(i-len(result)):
  result = "a"+result
print(result)

Submission status: Accepted

Solution code:
import sys
import math
import collections

def set_debug(debug_mode=False):
    if debug_mode:
        fin = open('input.txt', 'r')
        sys.stdin = fin


def int_input():
    return list(map(int, input().split()))


def get(s):
    return str(s % 9) + '9' * (s // 9)

if __name__ == '__main__':
    # set_debug(True)

    # t = int(input())
    t = 1

    for ti in range(1, t + 1):
        n = int(input())

        res = ''

        while n >= 1:
            n -= 1
            mod = n % 26
            n = n // 26
            res += chr(ord('a') + mod)

        print(res[::-1])

Submission status: Accepted

Solution code:
'''
参考:1
https://tanuhack.com/num2alpha-alpha2num/
数値からアルファベットの変換…10進数→26進数
-----
例えば、『1000』という数値をアルファベットに変換させる場合、
1. 26のn乗で1000以下の最大のnを求める→『n+1』がアルファベットの桁数、n=2
2. (26^2)*xで1000以下の最大のxを求める→x=1、つまり3桁目のアルファベットはA
3. (26^1)*yで1000-(26^2)*1=324以下の最大のyを求める→y=12、つまり2桁目のアルファベットはL
4. (26^0)*z=12→つまり3桁目のアルファベットはL、ゆえに1000はALL
と、再帰を使って算出
-----

参考:2
https://note.nkmk.me/python-chr-ord-unicode-code-point/
整数（Unicodeコードポイント）→文字
'''
def num2alpha(num):
    if num <= 26:                                   # num == 1, num == 2, ...etc
        return chr(96+num)                          # chr(97) == 'a'
    elif num % 26 == 0:                             # num == 26, num == 52, ...etc
        return num2alpha(num//26-1)+chr(122)        # chr(122) == 'z', ∴num == 52 ⇒ 'az'
    else:                                           # num == 27, num == 53, ...etc
        return num2alpha(num//26)+chr(96+num%26)    # ∴num == 53 ⇒ 'ba'


N = int(input())
ans = num2alpha(N)

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = ''
 
    while N > 0:
        N -= 1
        ans += chr(ord('a') + N % 26).lower()
        N = N // 26
    print(ans[::-1])
 
 
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰回数の上限を変更
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:
def main():
    N = int(input())
    ans = ''

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input()) - 1
    digits = []

    while True:
        a, b = N // 26, N % 26
        digits.append(b)
        if a == 0:
            break
        N = a - 1

    digits.reverse()
    chars = map(to_alphabet, digits)
    print(''.join(chars))


def to_alphabet(x: int):
    return chr(65 + x).lower()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input()) - 1
    digits = []

    while True:
        a, b = N // 26, N % 26
        if a == 0:
            digits.append(b)
            break
        digits.append(b)
        N = a - 1

    digits.reverse()
    chars = map(to_alphabet, digits)
    print(''.join(chars))


def to_alphabet(x: int):
    return chr(65 + x).lower()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s=''
while n!=0:
  n-=1
  tmp=n%26
  s=chr(96+tmp+1)+s
  n//=26
print(s)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

N = INT()

ans = ""
while 0 < N:
	N -= 1
	ans += ascii_lowercase[N%26]
	N //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline().rstrip('\n')
    

def calc(N):
    abc = 'abcdefghijklmnopqrstuvwxyz'
    s = ''
    while N > 0:
        i = (N - 1) % 26
        N = (N - 1) // 26
        s = abc[i] + s
    return s

N = int(input())
print(calc(N))

Submission status: Accepted

Solution code:
q = int(input())
s = ""
while q != 0:
    q -= 1
    s += chr(q % 26 + 97)
    q = q // 26
print(s[::-1])

Submission status: Accepted

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
# n=1000000000000001

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(n))

Submission status: Accepted

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

while n!=0:
  n=n-1
  ans.append(chr(n%26+97))
  n=n//26
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
def A(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def B(n, k, p_list):
  p_list = sorted(p_list)
  print(sum(p_list[:k]))


def C(N):
  for i in range(99):
    if N < 26**i:
      ans = []
      for j in range(i):
        ans += chr(ord('a') + N % 26)
        N //= 26
      return ''.join(ans[::-1])
    else:
      N -= 26**i


def main():
  # letter = input()
  # A(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   A(x)

  # n, k = map(int, input().split())
  # p_list = map(int, input().split())
  # B(n, k, p_list)
  print(C(int(input())))
  #for i in range(1, 27):
  #  print(C(26 + i))
  # C(703)
  # C(18279)
  # C(475254)


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N=int(input())
START = 96
ALP = 26
ans = []
while True:
  if N <= ALP:
    ans.append(chr(START + N)) 
    break
  p = N % ALP
  if p == 0:
    ans.append(chr(START + ALP))
  else:
    ans.append(chr(START + p))
  if p == 0:
    N -= 1
  N = N // ALP
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())

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

    print(ans)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    from string import ascii_lowercase

    N = int(input())

    def rec(n):
        if n == 0: return ''
        n -= 1
        n, r = divmod(n, 26)
        return rec(n) + ascii_lowercase[r]

    print(rec(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
import sys
### stdin
def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
OutV = lambda x: print(*x, sep='\n')
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

## 10進数をn進数に変換(出力はstr)
## in: int X
## in: int n
## out: str
## (n-1)の桁数に合わせて0埋めをする
def Base_10_to_n(X, n):
    digit = len(str(n - 1))
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n).zfill(digit)
    return str(X%n).zfill(digit)

import string
alphabet = list(string.ascii_lowercase)


N = iIn()

s = Base_10_to_n(N, 26)

lst = []
for i in range(len(s)//2):
    var = s[2*i] + s[2*i+1]
    lst.append(int(var))
lst = lst[::-1]
## N = 26 -> lst = [0, 1]

solver = []
for i in range(len(lst)):
    if lst[i] > 0:
        solver.append(lst[i])
    else:
        if i == len(lst) - 1:
            break
        lst[i+1] -= 1
        solver.append(lst[i]+26)
solver = solver[::-1]

ans = ''
for i in range(len(solver)):
    ans += alphabet[solver[i]-1]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
n -= 1
a = 0
dig = 1
while a + 26**dig <= n:
    a += 26**dig
    dig += 1
n -= a
ans = []
for i in range(dig):
    ans += [chr(n % 26 + 97)]
    n //= 26
print(''.join(reversed(ans)))

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())
a=26
ans=''
while N>0:
	N-=1
	ans+=chr(ord('a')+N%a)
	N//=a
print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
ans=''
check='abcdefghijklmnopqrstuvwxyz' #c(a)-1=0,c(b)-1=1,…,c(z)-1=25を対応づける文字列
while n!=0:
 n-=1
 ans+=check[n%26] #(n-1)%26がc(Sk)-1を表すので、上記の文字列を用いてc(Sk)-1からSkを求める
 n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
name = ["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"]
NUM = 26
id = ""
N = int(input())

while True:
  q = N // NUM
  mod = N % NUM
  if mod == 0:
    q = q-1
    mod = 26
  else:
    None

  id = name[mod-1]+id
  if q <= 0:
    break
  
  if q <= 26 and q > 0:
    id = name[q-1]+id
    break
  else:
    N = q
  
print(id)

Submission status: Accepted

Solution code:
import math
n=a=int(input())
len=0
while a>=1:
  a=math.ceil(a/26)
  a-=1
  len+=1
  n-=26**len
n+=26**len-1
dp=[0]*len

for i in range(len):
  s=26**(len-i-1)
  dp[i]=chr(n//s+ord("a"))
  n-=26**(len-i-1)*(n//s)
print("".join(dp))

Submission status: Accepted

Solution code:
n = int(input())
s=''
k=1
while n>0:
    if n-26**k>0:
        n-=26**k
        k+=1
    else:
        p='abcdefghijklmnopqrstuvwxyz'
        #print(len(p))
        j=0
        while n>0:
            if n-26**(k-1)>0:
                n-=26**(k-1)
                j+=1
            else:
                s+=p[j]
                #print(s,n,k,j)
                if n==1 and k==1:
                    n=0
                j=0
                k-=1
                
                
print(s)

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=''
check='abcdefghijklmnopqrstuvwxyz'
while n!=0:
  n-=1
  ans+=check[n%26]
  n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
A = ('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 = []

if N <= 26:
    amari = N % 26
    S.append(amari)
else:
    while N != 0:
        amari = N % 26
        if amari == 0:
            S.append(26)
            N = (N-1)//26
        else:
            S.append(amari)
            N = N//26

S.reverse()
Moji = ''
for i in range(len(S)):
    Moji = Moji + A[S[i]-1] 
print(Moji)

Submission status: Accepted

Solution code:
n=int(input())
num=[]
while n!=0:
    n-=1
    p=n%26
    n=n//26
    num.append(p)
c=[]
for i in range(len(num)-1,-1,-1):
    c.append(chr(ord("a")+num[i]))
print("".join(c))

Submission status: Accepted

Solution code:
import string
def frac(digit,n):
  ans[digit]=n%26
  if n < 26:
    return
  else:
    frac(digit+1,n//26)
    return

n = int(input())
l=0
r=0
for i in range(1,10000000000000000000000):
  l = r+1
  r = l+26**i-1
  if l <= n <= r:
    n = n-l+1
    break

n=n-1
ans=[0]*i

frac(0,n)
res=""
for i in ans[::-1]:
  res+=string.ascii_lowercase[i]
print(res)

Submission status: Accepted

Solution code:
import math

N = int(input())

group_seq_index = math.ceil(math.log(25*N/26+1)/math.log(26))
char_li = [chr(i) for i in range(97,97+26)]
li = []
a = ''

N -= int((1 - 26 ** (group_seq_index + 1)) / -25)

for i in range(group_seq_index):
  li.append(N % 26)
  N = N // 26

for index in reversed(li):
  a += char_li[index]
  
print(a)

Submission status: Accepted

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

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

def main():
    N = int(readline())
    print(num2alpha(N).lower())

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:#例　26*12 = 26^1 * 11 + 26^0 * 26に変換する
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
n = int(input())
print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
def int2char(i):
    return chr(ord("a") + i - 1)

N = int(input())

ans = ""
while (True):
    N_lsb_int = ((N - 1) % 26) + 1
    N_next = int((N - N_lsb_int)/26)
    ans = int2char(N_lsb_int) + ans
    if N_next == 0:
        break
    N = N_next

print(ans)

Submission status: Accepted

Solution code:
import sys

def main(n):
    c = "abcdefghijklmnopqrstuvwxyz"
    m = {}
    for i in range(0, 26):
        m[i+1] = c[i]

    s = ""
    while n > 0:
        if n%26 == 0:
            t = 26
            n //= 26
            n -= 1
        else:
            t = n%26
            n //= 26
        s = m[t] + s
    return s

n = int(sys.stdin.readline().strip())
print(main(n))

Submission status: Accepted

Solution code:
import string

def main(N):
    if N <= 26:
        return string.ascii_lowercase[N-1]
    if N % 26 == 0:
        return main(N//26 - 1) + string.ascii_lowercase[25]
    return main(N//26) + string.ascii_lowercase[N%26 - 1]

N = int(input())
print(main(N))

Submission status: Accepted

Solution code:
n = int(input())
p = 26
while n > p:
  n -= p
  p *= 26

n -= 1
s = ''
while p > 1:
  n, r = divmod(n, 26)
  s = chr(97 + r) + s
  p //= 26
print(s)

Submission status: Accepted

Solution code:
N=int(input())
for i in range(1,15):
    if 26**i>=N:
        n=i
        break
    else:
        N-=26**i
l=[0]*n
N-=1
for i in range(n):
    l[i]=N%26
    N//=26
for i in l[::-1]:
    print(chr(ord("a")+i),end="")

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
check = 'abcdefghijklmnopqrstuvwxyz'
while n != 0:
    n -= 1
    ans += check[n%26]
    n //= 26
print(ans[::-1])

Submission status: Accepted

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

while N > 0: 
	N -= 1
	m = N%26 
	s.append(ascii_lowercase[m])

	N = int(N/26)

	
s.reverse()
s = ''.join(s)
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
abc = '_abcdefghijklmnopqrstuvwxyz'
name = ''

def get_name(N):
    if N<=26:
        return abc[N]
    else:
        N_sub = (N-1)%26 + 1
        sub_name = abc[N_sub]
        N_new = (N - N_sub)//26
        return get_name(N_new) + sub_name
print(get_name(N))

Submission status: Accepted

Solution code:
n=int(input())
l=[]
while(n!=0):
    n=n-1
    l.append(chr(ord('a')+(n%26)))
    n=int(n/26)
l=l[::-1]
print("".join(l))

Submission status: Accepted

Solution code:
# Problem C - One Quadrillion and One Dalmatians

# input
N = int(input())

# initialization
alphabet = "zabcdefghijklmnopqrstuvwxy"
ans = ""

# check
if N>=1 and N<=26:
    ans = alphabet[N%26]
else:
    while N>0:
        if N%26==0:
            ans += alphabet[0]
            N = N // 26 -1
        else:
            ans += alphabet[N%26]
            N = N // 26

# output
ans = ans[::-1]
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())
lst = list()
 
while True:
  a, b = divmod(n, 26)
  n = a
  lst.append(b)
  if a == 0:
    break
 
for i in range(len(lst) - 1):
  if lst[i] <= 0:
    lst[i] += 26
    lst[i + 1] -= 1
 
if lst[-1] == 0:
  lst.pop()
 
for i in range(len(lst)):
  lst[i] = chr(lst[i] + 96)
 
print("".join(lst[::-1]))

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=[]
    for i in range(100):
        temp=(N-1)%26+ord("a")
        s=chr(temp)
        ans.append(s)
        N=(N-1)//26
        if N==0:
            break
        
    print(''.join(map(str, ans[::-1])))

main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    base = 26
    orig = ord('a')
    ans = ''
    for exp in range(1, 12):
        if (tmp := pow(base, exp)) >= n:
            n -= 1  # zero_indexed for ASCII mod
            for digit in range(exp):
                ans += (chr(orig + n % base))
                n //= base
            break
        else:
            n -= tmp
    print(ans[::-1])


if __name__ == '__main__':
    main()