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:
def resolve():
    import sys
    input = sys.stdin.readline
    # 整数 1 つ
    n = int(input())
    # 整数複数個
    # a, b = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    import sys
    import math

    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 = []

    def alphabet_decimal(v):
        quotient = math.floor(v / len(ALPHABET))
        surplus = v % len(ALPHABET)
        quotient -= 1 if surplus == 0 else 0
        surplus = len(ALPHABET) if surplus == 0 else surplus
        result.append(surplus)
        if len(ALPHABET) < quotient:
            alphabet_decimal(quotient)
        elif len(ALPHABET) < v:
            result.append(quotient)
        return "".join([ALPHABET[i - 1] for i in reversed(result)])

    res = alphabet_decimal(n)

    print(res.lower())

resolve()

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

Submission status: Accepted

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

while N > 0:
    ans.append(alphabets[N % 26-1])
    N = (N-1)//26

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

Submission status: Accepted

Solution code:
N = int(input())
temp_list = []
while N >= 1:
    a = (N - 1) % 26
    temp_list.append(a)
    N = (N - a) // 26

for i in temp_list[::-1]:
    print(chr(97 + i), end="")
print()

Submission status: Accepted

Solution code:
N = int(input())
a = (N-1)//26
b = N%26
ans = ''
while a!=0:
  if b==0:
    b = 26
  ans = chr(b+96) + ans
  b = a%26
  a = (a-1)//26

if b==0:
  b=26
ans = chr(b+96) + ans
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
N-=1
s ='abcdefghijklmnopqrstuvwxyz'
b = []
while True:
    a = N % 26
    b.append(s[a])
    N = N // 26
    if N == 0:
        break
    N -= 1
for i in range(len(b)):
    a = len(b)-i-1
    print(b[a], end='')

Submission status: Accepted

Solution code:
N=int(input())

#26真数
abc=list("abcdefghijklmnopqrstuvwxyz")

ans=""
while True:
    ans=abc[N%26-1]+ans
    #print(ans,N)
    if N<27:
        break
    N=(N-1)//26
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:
n = int(input())


l = []

nc = n

while nc > 0:
    if nc % 26 == 0:
        l.append(26)
    else:
        l.append(nc % 26)
    nc -= 1
    nc //= 26

ans = ''

for i in range(len(l)):
    ans += chr(l[-(1+i)] + 96)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lis = [0,26]
num = 26
n = 1
while lis[-1]<N:
    num *= 26
    lis.append(lis[-1]+num)
    n += 1
c = N-lis[-2]-1
ans = ''
for i in range(n):
    ans = chr(c%26+ord('a')) + ans
    c //= 26
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=[]
def a(i):
    if i==0:
        return 26
    else:
        return i
while n>26:
    k+=[chr(96+a(n%26))]
    if n%26==0:
        n=n//26-1
    else:
        n//=26
k+=[chr(96+a(n))]
print("".join(k[::-1]))

Submission status: Accepted

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

keta = 0
for i in range(1,20):
    nn -= (26 ** i)
    if nn <= 0:
        keta = i
        break

nn += (26 ** keta - 1)
a = []
for i in range(keta):
    x = nn % 26
    nn //= 26
    a.append(x)
        
ans = []
for i in a[::-1]:
    ans.append(chr(97+i))
    
print(*ans,sep="")

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())-1
    alp = "abcdefghijklmnopqrstuvwxyz"
    s = []
    while n >= 0:
        s.append(alp[n%26])
        n = (n//26-1)
    print("".join(s[::-1]))

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
for d in range(1, 16):
    n = (N-1) % 26
    ans += chr(97+n)
    if ((N-1) // 26) == 0: break
    N = (N-1) // 26        
print(ans[::-1])

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    print(num2alpha(N).lower())

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

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
# for use in beginner level contests where speed is key

a = int(input())

abc = "abcdefghijklmnopqrstuvwxyz"

cnt = 0
arr = [0]
back = None

for i in range(1,12):
    cnt += 26**i
    arr.append(cnt)
    if cnt > a:
        break

b = a - arr[i-1] - 1

res = ""
for j in range(i-1, -1, -1):
    res += abc[b//(26**j)]
    b = b%(26**j)

if set(res) == set("z"):
    res = res[:-1]

print(res)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    num = []
    now = 0
    for i in range(12):
        now += pow(26,i + 1)
        num.append(now)
    #print(num)
    for i in range(12):
        if num[i] >= N:
            length = i
            break
    #print(length)
    ans = ''
    if length > 0:
        N -= num[length - 1]
    N -= 1
    
    #print(N)
    now = pow(26,length)
    for j in range(length + 1):
        x = N//now
        ans += chr(x + 97)
        N %= now
        now //=26
        #print(ans)
    
    print(ans)
if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
N = int(input())

alf = [
    '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',
]

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n)-1, n)+alf[(X%n)]
    return alf[(X%n)]

N26 = Base_10_to_n(N-1, 26)
print(N26)

Submission status: Accepted

Solution code:
from collections import deque
N = int(input()) - 1
ans = deque([N % 26])
while N > 25:
  N //= 26
  N -= 1
  ans.appendleft(N % 26)
answer = "".join(map(lambda x: chr(ord("a") + x), ans))
print(answer)

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

i=1
now=26
before = 0
while True:
    if N <= now:
        break
    i += 1
    before = now
    now += 26**i
    
#print(i)
M = N-before
alphabet = "abcdefghijklmnopqrstuvwxyz"
ans=""
for j in range(i):
    dig = int((M-1)//26**(i-j-1))
    #print(M, dig)
    ans = ans + alphabet[dig]
    M -= dig*26**(i-j-1)
    
print(ans)

Submission status: Accepted

Solution code:
# 2020/06/21
# AtCoder Beginner Contest 171 - C

# Input
n = int(input())

# Calc
wkval = n

str = ''
while(wkval > 0):
    div = wkval // 26
    rem = wkval % 26
    if rem == 0:
        str = 'z' + str
        div = (wkval - 1) // 26
    else:
        str = chr(96 + rem) + str
    wkval = div

# Output
print(str)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni() - 1
    i = 1
    v = 26
    while n - v >= 0:
        n -= v
        i += 1
        v *= 26
    s = ''
    for _ in range(i):
        v //= 26
        s += chr(97 + n // v)
        n %= v
    print(s)
    return

solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
alfabet = 'abcdefghijklmnopqrstuvwxyz'
name = ''
while True:
  if n <= 26:
    name = alfabet[n-1] + name
    break
  else:
    num = n % 26
    name = alfabet[num-1] + name
    if n%26 ==0:
      n = (n//26) -1
    else:
      n = n//26
print(name)

Submission status: Accepted

Solution code:
import math
n = int(input())
alphabets = 'abcdefghijklmnopqrstuvwxyz'
def f(X):
    if (int((X-1)/26)):
        return f(int((X-1)/26))+alphabets[(X-1)%26]
    return alphabets[(X-1)%26]
print(f(n))

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)

if __name__ == '__main__':
    n = int(input())
    print(num2alpha(n).lower())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = []
while N > 0:
    if N%26 == 0:
        ans.append(26)
        N //= 26
        N -= 1
    else:
        ans.append(N%26)
        N //= 26
print("".join([chr(ord('a') + x-1) for x in reversed(ans)]))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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)
        
ANS=num2alpha(N)
print(ANS.lower())

Submission status: Accepted

Solution code:
n = int(input())

alpha = 'abcdefghijklmnopqrstuvwxyz'

out = ''
while n != 0:
    out = alpha[(n % 26) - 1] + out
    n = int((n-1) // 26)
print(out)

Submission status: Accepted

Solution code:
N = int(input())

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)
print(str.lower(num2alpha(N)))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():

    n = Z()
    alf = 'zabcdefghijklmnopqrstuvwxy'
    ans = []
    while n > 0:
        n, b = divmod(n, 26)
        ans.append(alf[b])
        if b == 0: n -= 1
    print(''.join(ans)[::-1])

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def to_char(a):
    return chr(a + ord("a"))

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

    res = ""
    while N >= 26:
        res = to_char(N % 26) + res
        N //= 26
        N -= 1

    print(to_char(N) + res)


if __name__ == "__main__":
    main()

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)


answer = num2alpha(N)
answer = answer.lower()

print(answer)

Submission status: Accepted

Solution code:
import numpy as np
import math
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:
N = int(input())
ans = ""
while N > 0:
  N -= 1
  n = N % 26
  ans = chr(ord("a") + n) + ans
  N //= 26

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
m = n
a = 1
count = 1
while a <= n:
    if a*26 >= m:
        break
    a*= 26
    m -= a
    count+=1
m -= 1
ans = []
for i in range(count):
    ans.append(m%26)
    m //= 26
ansa = ""
for i in ans:
    ansa += chr(97+i)
print(ansa[::-1])

Submission status: Accepted

Solution code:
n=int(input())
l=[]
while n>0:
  x=(n-1)%26
  l.append(x)
  n-=(x+1)
  n//=26
a=''
s=[chr(i) for i in range(97, 97+26)]
for x in l:
  a=s[x]+a
print(a)

Submission status: Accepted

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

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

name.reverse()
print("".join(name))

Submission status: Accepted

Solution code:
def funct(num):
    capitals = [chr(x) for x in range(ord('a'), ord('z')+1)]
    result = []
    while num > 0:
        result.append(capitals[(num-1)%26])
        num = (num-1) // 26
    result.reverse()
    return ''.join(result)

print(funct(int(input())))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


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


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()


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)
print(ans.lower())
# # 26進数
# num = 26
# keta_su = 1
# keta = [26]
# while keta[-1] < N:
#     keta_su += 1
#     keta.append(pow(26, keta_su) + keta[-1])
# print(keta[-2])
# keta[-2] + 1  # 'a'*keta_su
# print('a'*keta_su)

Submission status: Accepted

Solution code:
n = int(input())

cum = 0
d = 1
for i in range(1, 100):
  if cum + 26**i>=n:
    #print(cum, d)
    break
  cum += 26**i
  d += 1

rest = n - cum - 1
ans = [0]*d
for i in range(d-1, -1, -1):
  ans[i] = rest//(26**i)
  rest = rest%(26**i)
  
ans = ans[::-1]
#print(ans)

alp = 'abcdefghijklmnopqrstuvwxyz'
mapp = {i:alp[i] for i in range(26)}
for i in range(d):
  ans[i] = mapp[ans[i]]
  
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)
n = int(input())
kotae = num2alpha(n)
print(kotae.lower())

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'

ans = ""
while(N > 0):
    N, mod = divmod(N, 26)
    if mod == 0:
        N -= 1
        ans = "z" + ans
    else:
        ans = ascii_lowercase[mod - 1] + ans

print(ans)

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())-1
    st=[]
    n=26
    for i in range(1,1000000):
        st.append(chr(N%n+ord("a")))
        N=int(N//n)
        if N==0:
            break
        N-=1
    st=st[::-1]
    print("".join(st))
    
    
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

i = 1
ans = []
while n > 0:
   v = (n % (26 ** i)) // (26 ** (i-1))
   if v == 0:
      ans.append('z')
      n -= (26 ** i)
      i += 1
   else:
      ans.append(chr(ord('a') + v - 1))
      n -= n % (26 ** i)
      i += 1
print("".join(reversed(ans)))

Submission status: Accepted

Solution code:
N = int(input())
alpha = "zabcdefghijklmnopqrstuvwxy"
ans = ""
while N > 0:
    ans = alpha[N%26] + ans
    if N%26==0:
        N = (N-26) //26
    else:
        N = N // 26
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
s=""
while N>0:
    x=N%26
    if x==0:
        x=26
        N=N//26-1
    else:
        N=N//26
    s=chr(96+x)+s
print(s)

Submission status: Accepted

Solution code:
N=int(input())
ta=[]
t=N
while t>0:
    t,m=divmod(t,26)
    if m==0:
        t-=1
    ta.append(m)
l='abcdefghijklmnopqrstuvwxyz'
ta=ta[::-1]
ans=''
for i in ta:
    ans+=l[i-1]
print(ans)

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = []
    while N > 0:
        tmp = N % 26
        if tmp > 0:
            ret.append(chr(ord('a') + tmp - 1))
        else:
            ret.append('z')
        N = (N - 1) // 26
    ret.reverse()
    ret = ''.join(ret)
    print(ret)
    return

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
    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)
      
if __name__ == '__main__':
  N = int(input())
  ans = num2alpha(N)
  print(ans.lower())

Submission status: Accepted

Solution code:
N = int(input())

L = 1
R = 26
R0 = 0

while N > R:
    R0 = R
    L += 1
    R += 26**L

N2 = N - R0 - 1
S = []

for _ in range(L):
    N2,d = divmod(N2, 26)
    S.append(chr(d + 97))

print(''.join(reversed(S)))

Submission status: Accepted

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


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:
import string
N = int(input())
tmp = 0
for digit in range(1, 100):
    tmp += 26**digit
    if tmp >= N:
        break
N -= sum(26**i for i in range(1, digit)) + 1
ans = []
while N:
    ans += [N % 26]
    N //= 26
ans += [0] * (digit - len(ans))
ans = ans[::-1]
print(''.join(string.ascii_lowercase[i] for i in ans))

Submission status: Accepted

Solution code:
N = int(input())

#N_bin = bin(N)[2:]

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)
ans=ans.lower()
print(ans)

Submission status: Accepted

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

while True:
  if N%26 == 0:
    ans.append('z')
  else:
    ans.append(chr(N%26+96))
  N = (N-1)//26
  if N == 0:
    break
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
x = 26
i = 1
ans = []
while n != 0:
    ans.append(chr(ord("a") + (n - 1) % x))
    n = (n - 1) // x

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

Submission status: Accepted

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

print(num2abc(int(input())).lower())

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
char = ['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:
    i = N%26
    ans.append(char[i-1])
    N = (N-1)//26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    N = NI()

    ans = ''
    while N > 0:



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


    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# a〜z -- START --
alf=['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']
# a〜z --- END ---

def main():
  n=I()
  ans=''
  while True:
    if n<=0:
      break
    x=n%26
    n-=1
    n//=26
    ans+=alf[x-1]
    # print(ans)

  ans=list(ans)
  ans.reverse()
  return ''.join(ans)

# main()
print(main())

Submission status: Accepted

Solution code:
n = int(input())
import string
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = alphabets[:26]
def base_cvt(value, n=26):
    tmp = int(value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n) -1
    idx = tmp%n
    result = characters[idx] + result
    return result
print(base_cvt(value= n -1))

Submission status: Accepted

Solution code:
n = int(input())
name = ""
dig_num = 0
sum_num = 0
pow26 = {0: 1}
while n > sum_num:
    dig_num += 1
    pow26[dig_num] = 26**dig_num
    sum_num += pow26[dig_num]
# print(dig_num)
i = dig_num-1
while i >= 1:
    n -= pow26[i]
    i -= 1

for i in range(dig_num):
    now_dig = ((n-1)//pow26[i])%26
    name = chr(ord("a")+now_dig) + name

print(name)

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    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']
    n = ii()
    tmp = 26
    cnt = 1
    while n > tmp:
        n-=tmp
        tmp*=26
        cnt+=1
    cnt-=1
    tmplist = []
    while cnt > 0:
        tmptmp = 26**cnt

        if n%tmptmp == 0:
            tmplist.append(n//tmptmp-1)

        else:
            tmplist.append(n//tmptmp)
        n%=tmptmp
        cnt-=1
    if n%26 == 0:
        tmplist.append(25)
    else:
        tmplist.append(n-1)

    ans = ''
    for i in tmplist:
        ans+=l[i]

    print(ans)



main()

Submission status: Accepted

Solution code:
def solve(N):
    s=0
    length=1
    tmp=26
    while(s<=N):
        if s+tmp>=N:
            break
        length+=1
        s+=tmp
        tmp*=26
    X=[0 for i in range(length)]
    A=N-s-1
    k=0
    while(A>0):
        X[k]=A%26
        A//=26
        k+=1
    #print(X)
    ans=""
    for i in X:
        ans=chr(i+97)+ans
    return ans
print(solve(int(input())))

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

ans=num2alpha(N)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = []
    itoa = 'abcdefghijklmnopqrstuvwxyz'
    while True:
        b = (N-1) % 26
        a.append(itoa[b])
        N = (N-1) // 26
        if N == 0:
            break
    print(''.join(reversed(a)))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import string

small = string.ascii_lowercase
n = int(input())

ans = ""
while n > 0:
    n -= 1
    r = n % 26
    ans = small[r] + ans
    n  = (n- r) // 26
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
alpha = "abcdefghijklmnopqrstuvwxyz"
count = 1
while True:
    if 26 ** count >= n:
        break
    else:
        n -= 26 ** count
        count += 1
n -= 1
num = []
for i in range(count):
    num.append(n % 26)
    n //= 26
num.reverse()
name = ""
for i in num:
    name += alpha[i]
print(name)

Submission status: Accepted

Solution code:
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


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


sys.setrecursionlimit(1000000)


def main():
    tmp = ""
    N = I()
    while N != 0:
        amari = (N % 26 - 1) % 26
        N = (N - 1) // 26
        tmp = chr(ord("a") + amari) + tmp

    print(tmp)


main()

Submission status: Accepted

Solution code:
N = int(input())

# 26進数
v = []
while True:
    N, mod = divmod(N, 26)
    if mod == 0:
        mod = 26
        N -= 1
    v.append(mod)
    if N < 26:
        v.append(N)
        break
v = v[::-1]
# print('v', v)
alphabets = list('0abcdefghijklmnopqrstuvwxyz')
s = []
for i in v:
    if i == 0:
        continue
    s.append(alphabets[i])
# print('s', s)
ans = ''.join(s)
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())

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

while True:
    ans.append(alpha[n%26-1])
    if n//26==0:
        break
    elif n==26:
        break
    else:
        n/=26
        n=math.ceil(n-1)

print("".join(reversed(ans)))

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)
S=num2alpha(N)
s=S.lower()
print(s)

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)

A = num2alpha(N)
print(A.lower())

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

import string
al = list(string.ascii_lowercase)
n = inp()
ans = ""
while n:
    n -= 1
    rem = n%26
    ans = al[rem] + ans
    n = (n-rem)//26
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

S = 'zabcdefghijklmnopqrstuvwxy'
l = []
while N > 0:
    k = N % 26
    l.append(S[k])
    N //= 26
    if k == 0:
       N -= 1
l.reverse()
print(''.join(l))

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()

n = 26
i = 1
while N-n > 0:
	N -= n
	n *= 26
	i += 1
N -= 1

ans = []
for i in range(i):
	r = N % 26
	ans.append(r)
	N = N // 26

name = ''
for i in reversed(ans):
	name += chr(ord('a')+i)
print(name)

Submission status: Accepted

Solution code:
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()

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

import numpy as np

n = int(input())

x = num2alpha(n).lower()
print (x)

Submission status: Accepted

Solution code:
n = int(input())
# num2alpha = lambda c: chr(c+64)
# for i in range(1,21):
#     if n-26**i>0:
#         n -= 26**i
#     else:
#         s = i
#         break
# b = ""
# for j in range(s):
#     t = s-j
#     b +=num2alpha(n%(26**(t-1)))
# print(b)
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())