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:
ascii = 96
N = int(input())
name = ''
while 1:
    q, mod = divmod(N, 26)
    # mod処理
    if mod == 0:
        name += 'z'
    else:
        name += chr(ascii+mod)
    # q処理
    if q >= 0 and q <= 26:
        if mod == 0:
            q -= 1
        if q > 0:
            name += chr(ascii+q)
        break
    else:
        if mod == 0:
            N = q - 1
        else:
            N = q
# name反転
name = name[::-1]
print(name)

Submission status: Accepted

Solution code:
def to_alphabet(n):
    S = "abcdefghijklmnopqrstuvwxyz"
    if (n - 1) // 26:
        return to_alphabet((n - 1) // 26) + S[(n - 1) % 26]
    return S[(n - 1) % 26]

n = int(input())
print(to_alphabet(n))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    res = ''
    d = 1
    base = []
    alp = 'abcdefghijklmnopqrstuvwxyz'
    for b in range(12):
        mod = n % 26
        if mod == 0:
            mod = 26
        res = alp[mod-1] + res
        if n - mod == 0:
            break
        else:
            n = int((n - mod) / 26)
            
    print(res)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
Norigin = N
alphabet = "abcdefghijklmnopqrstuvwxyz"
j = 0
start = 0
end = 0
while 1:
    if N <= 0:
        end = start + 26**(j)
        break
    else:
        start += 26**j
        j += 1
        N -= 26**j
ans = []
Norigin = Norigin-start
for i in range(j):
    ans.append(alphabet[Norigin % 26])
    Norigin = Norigin//26
ans.reverse()
print("".join(ans))

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)


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

    print(num2alpha(N).lower())


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

AlList = {0:'Z', 1:'A', 2:'B', 3:'C', 4:'D', 5:'E', 6:'F', 7:'G', 8:'H', 9:'I', 10:'J', 11:'K', 12:'L', 13:'M', 14:'N', 15:'O', 16:'P', 17:'Q', 18:'R', 19:'S', 20:'T', 21:'U', 22:'V', 23:'W', 24:'X', 25:'Y', 26:'Z'}

result = ''

while 'true':
    if N > 26:
        tmp = N % 26
        result = AlList[tmp] + result
        N //= 26
        if tmp == 0:
            N -= 1
    else:
        result = AlList[N] + result
        break
print(result.swapcase())

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)

n = input()
n = int(n)

ans = num2alpha(n)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
#l=["z"]
#for i in range(97,122):
#    l.append(chr(i))
l=[chr(i) for i in range(97,123)]
#print(l)
ans=""
i=1
while True:
    if i==1:
        if n%26!=0:
            x=n%26
            n=n//26
        else:
            x=n%26
            n=n//26 -1
    else:
        if n%26!=0:
            x=n%26
            n=n//26
        else:
            x=n%26
            n=n//26 -1
    ans+=l[x-1]
    #print(ans,n,x)
    i+=1
    if n==0:
        break
ans=ans[::-1]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

k = list()
while(N >= 27):
  a = int(N%26)
  if a==0:
    a =26
  k.insert(0,a)
  N = (N-a)/26

k.insert(0,int(N))
ans = str()
for i in range(len(k)):
  x = k[i] + 64 +32
  ans = ans + str(chr(x))
#print(k)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
l = [0, 26]

for i in range(30):
    l.append(l[-1]*26)

for i in range(len(l)):
    if N-l[i]>0:
        N -= l[i]
    else:
        keta = i
        break

ans = []
alpha = 'abcdefghijklmnopqrstuvwxyz'

for i in range(keta):
    for j in range(26):
        if N-pow(26, keta-1-i)>0:
            N -= pow(26, keta-1-i)
        else:
            ans.append(j)
            break

ans2 = []

for i in ans:
    ans2.append(alpha[i])

print(''.join(ans2))

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())
p=num2alpha(n)
p=p.lower()
print(str(p))

Submission status: Accepted

Solution code:
N = int(input())
ans = []
alp = 'abcdefghijklmnopqrstuvwxyz'

def dfs(N):
    n, r = divmod(N-1, 26)
    ans.append(alp[r])
    if N <= 26:
        return (n, r)
    return dfs(n)

dfs(N)
print("".join(ans[::-1]))

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:

alpha = "abcdefghijklmnopqrstuvwxyz"

N = int(input())

dog_name = ""

while N > 0:
    dog_name += alpha[(N-1)%26]
    N = (N-1) // 26

dog_name = dog_name[::-1]

print(dog_name)

Submission status: Accepted

Solution code:

a_list = ['z'] + [chr(ord('a') + i) for i in range(25)]

def get_alphabet(c: int, s: str) -> str:
    s += a_list[c % 26]
    if c / 26 <= 1:
        return s
    else:
        c = (c - 1) // 26 if c / 26 >= 1 else c // 26
        return get_alphabet(c, s)

n = int(input())

ans = get_alphabet(n, '')

print(''.join(reversed(ans)))

Submission status: Accepted

Solution code:
N=int(input())
tmp=26
for i in range(1,1000):
    if N<=tmp:
        nl=i
        break
    else:
        tmp+=26**(i+1)

# 名前の長さnlの中で辞書順にx番目
x=N-tmp+26**nl
ans=[]
alp=[chr(i) for i in range(97, 97+26)]

for i in range(nl-1,-1,-1):   
    for j in range(1,27):
        if j*(26**i)>=x:
            ans.append(alp[j-1])
            x-=(j-1)*(26**i)
            break
print("".join(ans))

Submission status: Accepted

Solution code:
num2alpha = lambda c: chr(c+64).lower()

N = int(input())
res = list()

while True:
  mod = N % 26
  if mod == 0:
      mod = 26

  res.insert(0,num2alpha(int(mod)))
  N = N // 26
  if mod == 26:
    N -= 1
  if N <= 0:
    break

print(''.join(res))

Submission status: Accepted

Solution code:
N = int(input())

#順に考えているとTLEする
#26進数と考える

if N <= 26:
    print(chr(96 + N))
else:
    ans = list()

    while 1:
        if N%26 != 0:
            ans.append(chr(96 + N%26))
        else:
            ans.append("z")
            N -= 1
        N = N//26

        if N <= 26:
            if N%26 != 0:
                ans.append(chr(96 + N%26))
            else:
                ans.append("z")

            break

    print(''.join(map(str, ans[::-1])))

Submission status: Accepted

Solution code:
n=int(input())

# alp='abcdefghijklmnopqrstuvwxyz'

# ########関数部分##############
# def Base_10_to_n(X, n):
#     if (int(X/n)):
#         return Base_10_to_n(int(X/n), n)+' '+str(X%n)
#     return str(X%n)
# ############################
# l=list(Base_10_to_n(n,26).split())
# print(l)
# ans=''

# for i in range(len(l)):
#     ans+=alp[int(l[i])-1]

# 数値→アルファベット
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)
ans=num2alpha(n).lower()

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def b(N):
    if N<=26:
        return chr(96+N)
    elif N%26==0:
        return b(N//26-1)+chr(122)
    else:
        return b(N//26)+chr(96+N%26)
        
print(b(N))

Submission status: Accepted

Solution code:
#-*- using:utf-8 -*-

alphabet = "abcdefghijklmnopqrstuvwxyz"

def alphabet_decimal(n):
    def convert(n):
        while n > 0:
            yield alphabet[(n - 1) % len(alphabet)]
            n = (n - 1) // len(alphabet)
    return ''.join(convert(n))[::-1]

if __name__ == '__main__':
    N = int(input())
    print(alphabet_decimal(N))

Submission status: Accepted

Solution code:
N = int(input())
base = ord('a')
r = []
q = N
for i in range(12):
    if q <= 26:
        r.append(q)
        break
    if q % 26 == 0:
        r.append(26)
        q = q // 26 - 1
    else:
        r.append(q % 26)
        q = q // 26
r.reverse()
ans = [chr(i+base-1) for i in r]
print(''.join(ans))

Submission status: Accepted

Solution code:
import sys
from itertools import permutations as pm
si = sys.stdin.readline
abc = 'abcdefghijklmnopqrstuvwxyz'


def former(i, n):
    s = ''
    for _ in range(i):
        s += abc[n % 26]
        n //= 26
    s = s[::-1]
    print(s)


def main():
    n = int(si())
    size = 26
    i = 1
    while n > size:
        n -= size
        size *= 26
        i += 1
    if i == 1:
        print(abc[n-1])
    else:
        former(i, n-1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n = I()
	alphabets = [chr(ord('a')+i) for i in range(26)]
	mod_list = []
	while n > 26:
		mod_list.append(n % 26)
		n = n // 26
	if n > 0:
		mod_list += [n]
	ans = ''
	def minus_one(i):
		if mod_list[i] != 0:
			mod_list[i] -= 1
		else:
			minus_one(i+1)
			mod_list[i] = 25
		return mod_list[i]
	for i in range(len(mod_list)):
		if i < len(mod_list) -1 or mod_list[i] > 0:
			ans = alphabets[minus_one(i)] + ans
	print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
d={1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j'\
   , 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's'\
   , 20: 't', 21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y', 26: 'z'}
l=[]
p=10
while p!=-1:
    a=n//26**p
    l.append(a)
    n-=a*26**p
    p-=1

for i in range(len(l)):
    if l[i]!=0:
        break
l=l[i:]
for j in range(12):
    for k in range(len(l)):
        if l[k]==0:
            if k!=0:
                
                l[k]=26
                if 0<=k-1<=len(l)+1:
                    l[k-1]-=1

m=""
for i in l:
    if i!=0:
        
        m+=d[i]
print(m)

Submission status: Accepted

Solution code:
n = int(input())


def getNameFromNumber(num):
    amari = (num - 1) % 26
    char = chr(97 + amari)
    div = (num - 1) // 26
    if div > 0:
        return getNameFromNumber(div) + char
    else:
        return char


print(getNameFromNumber(n))

Submission status: Accepted

Solution code:
n=int(input())
ls_1 = []
for i in range(1,12):
  ls_1.append(int((26**i-1)/25))
#print(ls_1)
pos = 0
for i in ls_1:
  if n < i:
    pos = ls_1.index(i)-1
    break
  elif n > 146813779479511:
    pos = 10
n_ = n-ls_1[pos]
#print(n_)
ans = [97]*(pos+1)
#print(ans)
ls_2 = []
for i in range(pos+1):
  ls_2.append(n_%26)
  n_ //= 26
  if n_==0:
    ls_2 = ls_2+[0]*(pos-i)
    break
#print(ls_2)
ls_2=ls_2[::-1]
for i in range(len(ans)):
  ans[i] = chr(ans[i]+ls_2[i])
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())

n_c = n - 1
w_dict = {0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5:"f", 6:"g" , 7:"h", 8:"i", 9:"j", 10:"k"
        , 11:"l", 12:"m", 13:"n", 14:"o" , 15:"p", 16:"q", 17:"r", 18:"s", 19:"t", 20:"u"
        , 21:"v", 22:"w", 23:"x", 24:"y", 25:"z"}
out = ""
while n_c > 25:
    out = out + w_dict[n_c % 26]
    n_c = n_c // 26 - 1

out = out + w_dict[n_c]
print(out[::-1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def number_to_alphabet(number):
    if number <= 26:
        return chr(96 + number)

    if number % 26 == 0:
        return number_to_alphabet(number // 26 - 1) + 'z'

    return number_to_alphabet(number // 26) + chr(96 + number % 26)


N = int(input())
result = number_to_alphabet(N)
print(result)

Submission status: Accepted

Solution code:
n=int(input())
ans=str()
j=0
m=[" ","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"]
while n!=0 or j==0:
    x=n%26
    if x == 0:
        x=26
        n-=1
    ans=m[x]+ans
    if n==26:
        break
    n//=26
    j=1
print(ans)

Submission status: Accepted

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

count = 0
num = []

N -= 1

while 1:
  #print(N % 26, N // 26)
  if N // 26 != 0:
    count += 1
    if N % 26 == 0 and count != 1:
      num.append(26)
      N //= 26
      N -= 1
    else:
      num.append(N % 26)
      N //= 26
  else:
    if N == 0:
      break
    else:
      num.append(N % 26)
      break
  	
ans = ''
  	
for i in range(len(num)):
  if i == 0:
  	ans += chr(97 + num[i])
  else:
    ans += chr(96 + num[i])
  
if n == 1:
  print('a')
else:
  print(ans[::-1])

Submission status: Accepted

Solution code:
N=int(input())

nlist=[]
while N:
  nlist.append((N-1)%26)  
  N=(N-1)//26
  
nlist.reverse()
#print(nlist)

answer_list=[]
for n in nlist:
  answer_list.append(chr(97+n))
  
print("".join(answer_list))

Submission status: Accepted

Solution code:
N = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ans = s[(N-1)%26]
N -= (N-1)%26
for i in range(25):
    if N < 26:
        break
    N = N//26
    ans = s[(N-1)%26] + ans
    N -= (N-1)%26

print(ans)

Submission status: Accepted

Solution code:
char_list = [ chr(ord('a')+num) for num in range( 26 ) ]
N = int(input())

def Base_10_to_n(X, n):
    if X % n != 0 and (int(X//n)):
        return Base_10_to_n(int(X//n), n)+str(char_list[((X%n)-1)%n])
    elif X % n == 0 and (int(X//n)):
        if X//n == 1:
            return str(char_list[((X%n)-1)%n])
        else:
            return Base_10_to_n(int((X-1)//n), n)+str(char_list[((X%n)-1)%n])
    return str(char_list[((X%n)-1)%n])

print(Base_10_to_n(N,26))

Submission status: Accepted

Solution code:
a = int(input())
sr_1 = 'abcdefghijklmnopqrstuvrxyz'

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(a).lower())

Submission status: Accepted

Solution code:
import string
a2z = string.ascii_lowercase

def routine(X, n):
   div = X//n if X % n > 0 else X//n - 1
   if div:
      return routine(div, n)+a2z[X%n-1]
   return a2z[X%n-1]

print(routine(int(input()), 26))

Submission status: Accepted

Solution code:
N = int(input())
# N = N-1
ans = ''
D = {0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k',11:'l',12:'m',13:'n',14:'o',15:'p',16:'q',17:'r',18:'s',19:'t',20:'u',21:'v',22:'w',23:'x',24:'y',25:'z'}
while True:
    N = N-1
    ans = ans+D[N%26]
    N = N//26
    if N == 0:
        break
    elif N <= 26:
        N = N-1
        ans += D[N%26]
        break
print(ans[::-1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python

def main():
    n = int(input())
    n -= 1
    name = ''
    abc = 'abcdefghijklmnopqrstuvwxyz'

    i = 1
    while n >= 0:
        q, r = divmod(n, 26)
        name = abc[r] + name
        n = q - 1
        i += 1
    print(name)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(solver(n))

Submission status: Accepted

Solution code:
n = int(input())

def trans(t): 
    alph = 'abcdefghijklmnopqrstuvwxyz'
    return alph[t]

ans = ''
i=n
while i > 0:
    s = (i-1) % 26
    i = (i-1) //26
    ans = trans(s) + ans

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
res = ""
for i in range(1,100):
    a = n % 26
    if n <= 26:
        break

    n = int(n / 26)
    
    if a == 0:
        res = "z" + res
        n -= 1
    if a == 1:
        res = "a" + res
    if a == 2:
        res = "b" + res
    if a == 3:
        res = "c" + res
    if a == 4:
        res = "d" + res
    if a == 5:
        res = "e" + res
    if a == 6:
        res = "f" + res
    if a == 7:
        res = "g" + res
    if a == 8:
        res = "h" + res
    if a == 9:
        res = "i" + res
    if a == 10:
        res = "j" + res
    if a == 11:
        res = "k" + res
    if a == 12:
        res = "l" + res
    if a == 13:
        res = "m" + res
    if a == 14:
        res = "n" + res
    if a == 15:
        res = "o" + res
    if a == 16:
        res = "p" + res
    if a == 17:
        res = "q" + res
    if a == 18:
        res = "r" + res
    if a == 19:
        res = "s" + res
    if a == 20:
        res = "t" + res
    if a == 21:
        res = "u" + res
    if a == 22:
        res = "v" + res
    if a == 23:
        res = "w" + res
    if a == 24:
        res = "x" + res
    if a == 25:
        res = "y" + res
        
if a == 0:
    res = "z" + res
if a == 1:
    res = "a" + res
if a == 2:
    res = "b" + res
if a == 3:
    res = "c" + res
if a == 4:
    res = "d" + res
if a == 5:
    res = "e" + res
if a == 6:
    res = "f" + res
if a == 7:
    res = "g" + res
if a == 8:
    res = "h" + res
if a == 9:
    res = "i" + res
if a == 10:
    res = "j" + res
if a == 11:
    res = "k" + res
if a == 12:
    res = "l" + res
if a == 13:
    res = "m" + res
if a == 14:
    res = "n" + res
if a == 15:
    res = "o" + res
if a == 16:
    res = "p" + res
if a == 17:
    res = "q" + res
if a == 18:
    res = "r" + res
if a == 19:
    res = "s" + res
if a == 20:
    res = "t" + res
if a == 21:
    res = "u" + res
if a == 22:
    res = "v" + res
if a == 23:
    res = "w" + res
if a == 24:
    res = "x" + res
if a == 25:
    res = "y" + res
print(res)

Submission status: Accepted

Solution code:
n = int(input())
n -= 1
i = 1
temp = 0
while temp <= n:
    temp += 26**i
    i += 1
temp -= 26**(i-1)
#print(n-temp)
R = n-temp
#print(i)

ans = []
for k in range(i-1):
    q, r = divmod(R, 26)
    ans.append(chr(r+ord('a')))
    R = q
#print(ans)
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import string

def solve(N: int):
    alphabet = string.ascii_lowercase
    digits = []
    nextDigits = []
    last = 0
    for i in range(1000):
        nd = 26**i + last
        last = nd
        if nd <= N:
            digits.append(nd)
            nextDigits.append(26**i)
        else:
            break
    # print(digits)
    s = ""
    # print(digits)
    for i in range(len(digits)-1,-1,-1):
        isFirstDigit = i == len(digits)-1
        if isFirstDigit:
            currentBaseNum = digits[i]
            index = (N-currentBaseNum)//nextDigits[i]
            s += alphabet[index]
            N = N - currentBaseNum - index * nextDigits[i]
        else:
            index = N //nextDigits[i]
            s+= alphabet[index]
            N = N - index * nextDigits[i]
    return s

# print(solve(26))
# s = ""
# for i in range(100000):
#     s += " " +solve(i)
# print(s)
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))

if __name__ == '__main__':
    main()

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:

def resolve():
  N = int(input())
  N_to_str = ""
  alphabet_list = "zabcdefghijklmnopqrstuvwxyz"
  # N -= 1
  while N > 0:
    N-=1
    N_to_str=alphabet_list[N%26+1]+N_to_str
    # if N==26:
    #   break
    N = (N-N%26)//26
  print(N_to_str)

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
n = int(input())-1
s = n//26
t = n%26
a = [chr(i) for i in range(97,97+26)]
if s == 0:
    ans = a[t]
elif s < 27:
    ans = a[s-1]+a[t]
else:
    s2 = (s-1)//26
    t2 = s%26
    if s2 < 27:
        ans = a[s2-1] + a[t2-1] + a[t]
    else:
        s3 = (s2-1)//26
        t3 = s2%26
        if s3 < 27:
            ans = a[s3-1] + a[t3-1] + a[t2-1] +a[t]
        else:
            s4 = (s3-1)//26
            t4 = s3%26
            if s4 < 27:
                ans = a[s4-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t] 
            else:
                s5 = (s4-1)//26
                t5 = s4%26
                if s5 < 27:
                    ans = a[s5-1] + a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t] 
                else:
                    s6 = (s5-1)//26
                    t6 = s5%26
                    if s6 < 27:
                        ans = a[s6-1] + a[t6-1]+ a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t]
                    else:
                        s7 = (s6-1)//26
                        t7 = s6%26
                        if s7 < 27:
                            ans = a[s7-1] + a[t7-1]+ a[t6-1]+ a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t]
                        else:
                            s8 = (s7-1)//26
                            t8 = s7%26
                            if s8 < 27:
                                ans = a[s8-1] + a[t8-1]+ a[t7-1]+ a[t6-1]+ a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t]
                            else:
                                s9 = (s8-1)//26
                                t9 = s8%26
                                if s9 < 27:
                                    ans = a[s9-1] + a[t9-1]+ a[t8-1]+ a[t7-1]+ a[t6-1]+ a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t]
                                else:
                                    s10 = (s9-1)//26
                                    t10 = s9%26
                                    if s10 < 27:
                                        ans = a[s10-1] + a[t10-1] + a[t9-1]+ a[t8-1]+ a[t7-1]+ a[t6-1]+ a[t5-1] + a[t4-1] + a[t3-1] +a[t2-1] +a[t] 
               
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
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']
name=''
for _ in range(11):
    name=alpha[N%26-1]+name
    if N<=26:
        break
    N=(N-1)//26

print(name)

Submission status: Accepted

Solution code:

s = "abcdefghijklmnopqrstuvwxyz"

def fA(N):
  if N <= 26: return s[N-1]
  a = (N-1) // 26
  b = N % 26

  return fA(a) + fA(b)

N = int(input())
print(fA(N))
# for N in range(710):
#   print(N, fA(N))

Submission status: Accepted

Solution code:
n=int(input())-1
j=26
while j<=n:
  n-=j
  j*=26
j//=26
ret = ""
while j:
  ret += "abcdefghijklmnopqrstuvwxyz"[n//j]
  #print(f'{n//j=}')
  n %= j
  j //= 26
print(ret)

Submission status: Accepted

Solution code:
import string

N = int(input())
char_list = string.ascii_lowercase
char_list = char_list[:-1]
char_list = 'z' + char_list

tmp = 0
count = 0
ans = ''
while 1:
    before = tmp
    count += 1
    tmp += 26**count
    if before < N <= tmp:
        tmp = N
        while 1:
             ans = char_list[tmp%26] + ans
             tmp = (tmp-1) // 26
             count -= 1
             if count == 0:
                 break
        break
    else:
        pass

print(ans)

Submission status: Accepted

Solution code:
def alpha(n):
    if n <= 26:
        return chr(ord('a')-1+n)
    elif n % 26 == 0:
        return alpha(n//26-1)+'z'
    else:
        return alpha(n//26)+chr(ord('a')-1+(n % 26))

n = int(input())
print(alpha(n))

Submission status: Accepted

Solution code:
alp = [chr(i) for i in range(97, 97+26)]
N = int(input())
q = N
s = ""
while True:
  q,m = divmod(q,26)
  if m == 0:
    m = 26
    q -= 1
  s = alp[m - 1] + s
  if q == 0:
    break
print(s)

Submission status: Accepted

Solution code:
def convert(n):
    r, i = "", 0
    while True:
        n, m = divmod(n, 26)
        if m == 0:
            n, m = n-1, 26
        r += chr(ord('`') + m)
        if n == 0:
            break
    return r[::-1]
print(convert(int(input())))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = []
    while n>25:
        p = n//26
        k = n-26*p
        if k==0:
            ans.append(26)
            n = p-1
        else:
            ans.append(k)
            n = p
    if n!=0:
        ans.append(n)
    ans = ans[::-1]
    b = []
    for i in range(len(ans)):
        b.append(chr(96+ans[i]))

    print(''.join(b))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

count = 1
c = 1

while c == 1:
    if n <= (26 ** count):
        c = 0
    else:
        n = n - 26 ** count
    count += 1

count -= 1
n -= 1

s = [0 for i in range(count)]


for i in range(count):
    s[i] = n % 26
    n = n // 26


result = ""
for i in range(count):
    result = chr(97 + s[i]) + result

print(result)

Submission status: Accepted

Solution code:
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
d = {i+1:s for i, s in enumerate(alp)}
s = ""
while True:
    q, mod = divmod(n, 26)
    if mod == 0:
        s = "z" + s
        n = q-1
    else:
        s = d[mod] + s
        n = q
    if n == 0:
        break
print(s)

Submission status: Accepted

Solution code:
N = int(input())

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

print(num2alpha(N))

Submission status: Accepted

Solution code:
N = int(input())

keta = 1
now_26 = 26
while N > now_26:
  keta += 1
  now_26 += 26 ** keta

num = N - int(now_26 - 26 ** keta) -1

answer = ""
for i in range(keta):
  answer += chr(97 + num % 26)
  num = num // 26

print(answer[::-1])

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)
num = int(input())
answer = num2alpha(num)
print(answer.lower())

Submission status: Accepted

Solution code:
n=int(input())
l = []
s='abcdefghijklmnopqrstuvwxyz'
while n > 0:
    l.append((n-1)%26)
    n = (n -1)// 26
ans = ''
for i in l[::-1]:
    ans += s[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

alpha = [chr(i) for i in range(97, 97+26)]


k=0
while N>=0:
    N -= 26**k
    k += 1

A = []
k -= 1
len_k = k
while k >= 0:
    A.append(N//(26**k))
    N %= (26**k)
    k -= 1

res = []
for i in A[-len_k:]:
    res.append(alpha[i])

print("".join(res))

Submission status: Accepted

Solution code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np
from collections import deque


def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

N = int(input())

nowN = 26
start = 1
order = 1

for i in range(1,1000):
    if N <= nowN:
        break
    order += 1
    start = nowN+1
    nowN = nowN + 26**(i+1)

item = [chr(i) for i in range(97, 97+26)]
ans = []

for i in range(0,order):
    for j in range(1,27):
        if N <= start-1 + j*26**(order-i-1):
            start = start + (j-1)*26**(order-i-1)
            ans.append(item[j-1])
            break


print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())

# N = 1000000000000001

alphabet = [chr(ord('a') + i) for i in range(26)]

resid = []

while(True):
    q, mod = divmod(N - 1, 26)

    resid.append(mod)

    if(q == 0):
        break

    N = q

# print(resid)

for i in range(len(resid)):
    e = resid.pop()

    print(alphabet[e], end = "")

print("")

Submission status: Accepted

Solution code:
n = int(input())


ans = []
while n > 0:
    #print(n, n%26)
    if n % 26 == 0:
        ans.append(26)
        n = (n-1) // 26
    else:
        ans.append(n % 26)
        n = n // 26


#print(ans[::-1])
print(''.join(map(lambda x: chr(ord('a')+x-1), 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)
    
N = int(input())
print(num2alpha(N))

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

l= "abcdefghijklmnopqrstuvwxyz"
n=int(input())
a=[1,26]
b=[1,26]
ans=[]
if n==1:
    print("a")
    exit()
for i in range(13):
    a.append(a[-1]*26)
    b.append(b[-1]+a[-1])
for i in range(15):
    if n<=b[i]:
        c=i
        m=n-b[i]-1
        break
for i in range(c,0,-1):
    m,ind=divmod(m,26)
    ans.append(l[ind])
ans=reversed(ans)
print(*ans,sep="")