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:
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys

N = int(sys.stdin.readline())


def Base_10_to_n(X, n):
    m = chr(X%n+ord("a"))
    if (X//n):
        return Base_10_to_n(X//n-1, n)+m
    return m

print(Base_10_to_n(N-1,26))

Submission status: Accepted

Solution code:
import math
N = int(input())-1
ans = []

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

Submission status: Accepted

Solution code:
def func(n, lf):
    cnt = 0
    if lf > 0:
        dif = alp[lf] - alp[lf-1]
    else:
        dif = 1
    while n > dif:
        n -= dif
        cnt += 1
    return n, cnt

N = int(input())

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

alp = []
alp.append(0)
num = 26
i = 1
while num <= 1000000000000001:
    alp.append(num)
    i += 1
    num += 26 ** i

#print(alp)

ans = ''
l = len(alp) - 1

while 1:
    if N - alp[l] > 0:
        break
    l -= 1

#print(l)

N = N - alp[l]

while l >= 0:
    ret = func(N, l)
    ans = ans + sam[ret[1]]
    N = ret[0]
    l -= 1

print(ans)

Submission status: Accepted

Solution code:
def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

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

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

Submission status: Accepted

Solution code:
N = int(input())
n = N
l = []
while True:
    a = n%26 if n % 26 != 0 else 26
    n = n // 26 - 1 if n % 26 == 0 else n // 26
    l.append(a)
    if n == 0:
        break
l.reverse()
print(*[chr(ans+96) for ans in l], sep='')

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri() - 1
li = []
while n >= 26:
  a = n%26
  li.append(a)
  n //= 26
  n -= 1
li.append(n)  
li.reverse()
ans = ''
for i in li:
  s = 'abcdefghijklmnopqrstuvwxyz'[i]
  ans += s
print(ans)

Submission status: Accepted

Solution code:
import math

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

N = int(input())

def run(n):
    a = 0
    for i in range(1, 12):
        if math.pow(26, i) >= n:
            break
        n -= int(math.pow(26, i))

    ans = ''
    for j in range(i-1):
        b = n // int(math.pow(26, i-j-1))
        amari = n % int(math.pow(26, i-j-1))
        if amari == 0:
            b -= 1
        ans += alphabets[b]
        n = n % int(math.pow(26, i-j-1))
    ans += alphabets[n-1]
    return ans
    
print(run(N))

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    alp = "zabcdefghijklmnopqrstuvwxy"
    ans = ""
    tmp = N
    while tmp > 0:
        ama = tmp%26
        tmp = (tmp-1)//26
        ans = alp[ama] + ans
    print(ans)


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:
#!python3.8
# -*- coding: utf-8 -*-
# abc171/abc171_c
import sys
from collections import deque

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    a = 'abcdefghijklmnopqrstuvwxyz'
    t = 0
    r = deque([]) 
    for i in range(15):
        N -= 26**i
        if N < 0:
            break
        r.appendleft(a[N // 26**i % 26])
    print(''.join(r))
    return

main()

Submission status: Accepted

Solution code:
n=int(input())
alpha=[chr(i) for i in range(97, 97+26)]
def calc(x):
  if x//26>0:
    return calc(x//26-1) + str(x%26).zfill(2)
  return str(x%26).zfill(2)
wk=calc(n-1)
ans=""
for i in range(0,len(wk),2):
  ans+=alpha[int(wk[i:i+2])]
print(ans)

Submission status: Accepted

Solution code:
abc = [chr(ord('a') + i) for i in range(26)] 
def n2a(n):
    if n <= 26:
        return abc[n - 1]
    elif n % 26 == 0:
        return n2a(n // 26 - 1) + abc[25]
    else:
        return n2a(n // 26) + abc[n % 26 - 1]

n = int(input())
print(n2a(n))

Submission status: Accepted

Solution code:
n = int(input())
def nume(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return nume(num//26-1)+chr(122)
    else:
        return nume(num//26)+chr(96+num%26)
print(nume(n))

Submission status: Accepted

Solution code:
N = int(input())

ans=''
while True:
  n = (N-1)%26
  ans = chr(n+64+1) + ans
  N = (N-1)//26
  if N == 0: break

print(ans.lower())

Submission status: Accepted

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

if n % 26 != 0:
    ans += chr(n % 26 + 96)
    n -= n % 26
else:
    ans += 'z'
    n -= 26

for i in range(1, 11):
    n = n // 26
    if n == 0:
        break
    if n % 26 != 0:
        ans = chr(n % 26 + 96) + ans
        n -= n % 26
    else:
        ans = 'z' + ans
        n -= 26
    
print(ans)

Submission status: Accepted

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

n = int(input())
for i in range(11):
  p = 0
  q = 0
  p = n%26
  if n==0 and p==0:
    l2[i]=""
  else:
    l2[i]=l[p]
    if p ==0:
      q = n - 26
    else:
      q = n - p
    n = q//26
print(l2[10]+l2[9]+l2[8]+l2[7]+l2[6]+l2[5]+l2[4]+l2[3]+l2[2]+l2[1]+l2[0])

Submission status: Accepted

Solution code:
n = int(input())
n_new = n
out = []
while n_new > 0:
  if n_new <= 26:
    out.insert(0, str(n_new))
    break
  if n_new % 26 == 0:
    out.insert(0, str(26))
    n_new = int((n_new / 26) - 1)
  else:
    out.insert(0, str(n_new % 26))
    n_new = int(n_new / 26)
ans = ''
for i in out:
  ans = ans + chr(64 + int(i))
print(ans.lower())

Submission status: Accepted

Solution code:
n = int(input())
name = ''
while n != 0:
    tmp = n%26
    n //= 26
    if tmp == 0:
        tmp = 26
        n -= 1
    name += chr(ord('a')+tmp-1)
print(name[::-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(num2alpha(N).lower())

Submission status: Accepted

Solution code:
A = int(input())

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

def Base_10_to_n_alp(X, n):
    X = X-1
    if (int(X/n)):
        return Base_10_to_n_alp(int(X/n), n)+alp[X%n]
    return alp[X%n]

print(Base_10_to_n_alp(A,26))

Submission status: Accepted

Solution code:
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while n > 0:
    n -= 1
    q, r = divmod(n, 26)
    ans += s[r]
    n = q
print(ans[::-1])

Submission status: Accepted

Solution code:
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)])

N = input()
ans = alphabet_decimal(int(N))
print(ans.lower())

Submission status: Accepted

Solution code:
n = int(input())
res = ""
while n > 0:
  n, rem = divmod(n - 1, 26)
  res = chr(97 + rem) + res

print(res)

Submission status: Accepted

Solution code:
from decimal import Decimal

N = int(input())
wordlist = [chr(i) for i in range(97, 97+26)]
ans=[]

while True:
    tmp = Decimal(N) % Decimal(26)
    N = Decimal(N) // Decimal(26)

    if tmp==0:
        N-=1

    ans.insert(0, wordlist[int(tmp-1)])

    if N == 0:
        break

print(*ans, sep='')

Submission status: Accepted

Solution code:
n = int(input())

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:
from string import ascii_lowercase as lc
from bisect import bisect_left

keta = [
  26,
  702,
  18278,
  475254,
  12356630,
  321272406,
  8353082582,
  217180147158,
  5646683826134,
  146813779479510,
  3817158266467286
]

n = int(input())
if n <= 26:
    print(lc[n-1])
    exit(0)
    
name = []
ind = bisect_left(keta, n)
n -= keta[ind-1] + 1
for i in range(ind):
    rem  = n % 26
    name.append(rem)
    n //= 26
name.append(n)
name.reverse()
#print(name)
print(''.join(lc[i] for i in name))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    A = list("zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz")
    beki = [0, 26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286]

    ika = 0
    for i in range(12):
        if n <= beki[i]:
            ika = i
            ran = n - beki[i-1]
            break

    t = ['']*ika
    for i in range(ika)[::-1]:
        d,m = divmod(ran,26)
        t[i] = A[m]
        ran = d
        if m != 0:
            ran += 1
#        if d == 0 or (d == 1 and m == 0):
#            break
    print(''.join(t))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

cnt = 1
a = ord("a")
while True:
    if N <= 26**cnt:
        N -= 1
        ans = []
        while 0 < N:
            ans.append(N%26)
            N //= 26
        print("a"*(cnt-len(ans)),end="")
        for i in range(len(ans)-1,-1,-1):
            print(chr(a+ans[i]),end="")
        print()
        break
    else:
        N -= 26**cnt
        cnt += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def n2a(num):
  if num <= 26:
    return chr(ord("a")+num-1)
  elif num % 26 == 0:
    return n2a(num//26 - 1) + chr(ord("z"))
  else:
    return n2a(num//26) + chr(ord("a")-1 + num%26)
    


N = int(input())

print(n2a(N))

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
while n > 0:
    n, remainder = divmod(n - 1, 26)
    ans = chr(65 + remainder) + ans
print(ans.lower())

Submission status: Accepted

Solution code:
import string

def run(n):
    '''
    '''
    _base_array = string.ascii_lowercase
    results = []
    while n > 0:
        results.append(_base_array[n%26 - 1])
        if n%26 == 0:
            n = n//26 - 1
            continue
        n = n//26

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



if __name__ == '__main__':
    n = int(input())
    run(n)

Submission status: Accepted

Solution code:
from math import floor
alphabets = ["_","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"]
n=int(input())
res = ""
i=10
while i>-1:
    divres = floor(n/(26**i))
    res += alphabets[divres]
    n-= divres * (26 ** i)
    i-=1
while res[0]=="_":
    res = res[1:]
#print(res)

i=len(res)-1
while i>-1:
    if res[i] == "_":
        j=0
        while res[i-j] == "_":
            j+=1
        if i == 0:
            res = res[1:]
        else:
            res = res[:i-j] + alphabets[alphabets.index(res[i-j])-1] + "y"*(j-1) + "z" + res[i+1:]
    i-=1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
res = ""
#res += chr(ord("a") -1 + (n % 27))
#n -= 1

c = 0
while True:
    n -= 26 ** c
    if n < 0:
        break
    ch = (n % (26 ** (c+1))) // (26 ** c)
    #print(ch, chr(ord("a") + ch))
    res += chr(ord("a") + ch)
    c += 1

print(res[::-1])

Submission status: Accepted

Solution code:
from string import ascii_lowercase

n = int(input())
l = []
while n:
  d, r = divmod(n, 26)
  l.append(ascii_lowercase[r-1])
  n = d
  if r == 0:
    n -= 1

l.reverse()
print(*l, sep="")

Submission status: Accepted

Solution code:
N = int(input())

first_idx = 1
last_idx = 26
cnt = 1
while N > last_idx:
    first_idx = last_idx + 1
    last_idx = 26 * (1 + last_idx)
    cnt += 1
# print("1st = {}, last = {}, dgt = {}".format(first_idx, last_idx, cnt))

idx = N - first_idx
# print("index = ", idx)
ans = ""
for i in range(cnt):
    rem = idx % 26
    idx = idx // 26
    ans = chr(97 + rem) + ans

print(ans)

Submission status: Accepted

Solution code:
import math
import sys
# N, K = [int(_) for _ in input().split()]
N = int(input()) - 1
m = 0
i = 1
while True:
  m += 26 ** i
  if N < m:
    break
  i += 1
digit = i
N = N - (m - 26 ** i)

name = ''
for i in range(digit):
  c = chr(97+(26 + N) % 26)
  name += c
  N //= 26
print(name[::-1])

Submission status: Accepted

Solution code:
N = int(input())
name = ''
div = 26
while(N > 0):
    N, mod = divmod(N, div)
    if mod == 0:
        mod = 26
        N -= 1
    atoz = chr(mod+96)
    #print(mod, atoz, N)
    atoz += name
    name = atoz
print(name)

Submission status: Accepted

Solution code:
borders = []
n = 0
for i in range(1, 12):
    n += 26 ** i
    borders.append(n)
borders.sort(reverse=True)
chars = [chr(97 + i) for i in range(26)]

N = n = int(open(0).read())
keta = {}
for i, b in enumerate(borders):
    j = 0
    k = 26 ** (11 - i)
    while n > b:
        n -= k
        j += 1
    if j > 0:
        keta[11 - i] = chars[j - 1]
if n > 0:
    keta[0] = chars[n - 1]
ret = [keta[i] if i in keta else '_' for i in range(12, -1, -1)]
print("".join(ret[12 - max(keta.keys()):]))

Submission status: Accepted

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

keta = 1
j = 1
while n > 26**j:
    n -= 26**j
    keta += 1
    j += 1

n = n-1
ans =''

while keta != 0:
    a = n //(26**(keta-1))
    if a != 0:
        n = n -(26**(keta-1)*a)
        ans += eigo[a]
    else:
        ans+= eigo[0]
    keta -= 1

print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
import string

N = int(input()) - 1
smap = dict(enumerate(string.ascii_lowercase))

res = []
while True:
    d, m = divmod(N, 26)
    res.append(m)
    if d-1 > 25:
        N = d-1
    else:
        if d == 0:
            break
        else:
            res.append(d-1)
            break

print("".join(smap[i] for i in reversed(res)))

Submission status: Accepted

Solution code:


# def base_10_to_n(X, n):
#     if (int(X/n)):
#         return base_10_to_n(int(X/n), n)+str(X%n)
#     return str(X%n)



# def main():

#     alp = 'abcdefghijklmnopqrstuvwxyz'
#     n = int(input())

#     s = base_10_to_n(n-1,26)
#     print(s)


# if __name__ == "__main__":
#     main()

alp = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
for i in range(10):
    ind1 = 26*(pow(26,i-1)-1)//25 + 1
    ind2 = 26*(pow(26,i)-1)//25 + 1
    if ind1 <= n < ind2:
        n_len = i

# print(n_len)

n = n
ans = ''
for i in range(20,1,-1):
    curr_a = n%26
    ind = curr_a -1
    if ind == -1: ind = 25
    ans += alp[ind]
    if n < 26:
        break
    n = n//26
    if ind == 25: 
        n=n-1
        if n <= 0:break

print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
ans=""
def re(n,ans):
    if n<=26:
        return ans+chr(n+96)
    rem=(n-1)%26
    div=(n-1)//26
    return re(div,ans+chr(rem+97))
print(re(n,"")[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
def kore(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return kore(num//26-1)+chr(90)
    else:
        return kore(num//26)+chr(64+num%26)
s=kore(N)
s=s.lower()
print(s)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

n = int(input())
L = []
a_l = 'abcdefghijklmnopqrstuvwxyz'
i = 1
L.append(1)
while True:
    if n//(26**i)>0:
        L.append(26**i+L[i-1])
    else:
        break
    i += 1

#print(L)
L  = sorted(L,reverse=True)

for i in range(len(L)):
    if i < len(L)-1:
        a = (n-L[i+1])//(L[i]-L[i+1])
        n = n%(L[i]-L[i+1])
    else:
        a = n
    #print(n,a)
    if (i == 0 and a > 0) or i > 0:
        print(a_l[a-1],end='')

Submission status: Accepted

Solution code:
n=int(input())
i=0
pl=list()
while True:
    i=i+1
    if (26*(1-26**(i-1)))/(1-26)+1<=n and n<=(26*(1-26**(i-1)))/(1-26)+26**i:
        break
a=n-(26*(1-26**(i-1)))/(1-26)-1
for l in range (i):
    a,b=divmod(a,26)
    pl.insert(0,(chr(int(b)+97)))
print("".join(pl))

Submission status: Accepted

Solution code:
import string

N = int(input())
alphabet = list(string.ascii_lowercase)
num2alphabet = {i + 1: a for i, a in enumerate(alphabet)}
num2alphabet[0] = "z"
ans = ""

while N > 0:
    num = N % 26
    ans += num2alphabet[num]
    if N <= 26:
        break

    if num == 0:
        N -= 1

    N = N // 26

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

Submission status: Accepted

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

n -= 1
li = [26 ** i for i in range(1, 20)]
for i in range(18):
    li[i+1] += li[i]

for i in range(19):
    if n >= li[i]:
        pass
    else:
        tmp = i
        if i == 0:
            pass
        else:
            n -= li[i-1]
        break

for i in range(tmp+1):
    ans += chr(ord('a') + n % 26)
    n //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
ans = []
q = 1
while q != 0:
    q, r = divmod(N, 26)
    if r == 0:
        r = 26
        q = q - 1
    ans.append(int(r))
    N = (N - r)/26
l = len(ans)
Ans = 'a'
for i in range(l):
    Ans += chr(ans[i]+96)
print(Ans[l:0:-1])

Submission status: Accepted

Solution code:
n = int(input())

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

k = 1
n1 = n

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

ans = ''

ans = c[n1%26]+ans

for i in range(k-1):
	if n1%26!=0:
		n1 = n1//26+1
	else:
		n1 = n1//26
	ans = c[n1%26]+ans

print(ans)

Submission status: Accepted

Solution code:
def convert(n):
    return chr(ord('a') + int(n))


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def ColIdxToXlName(idx):
    if idx < 1:
        raise ValueError("Index is too small")
    result = ""
    while True:
        if idx > 26:
            idx, r = divmod(idx - 1, 26)
            result = chr(r + ord('a')) + result
        else:
            return chr(idx + ord('a') - 1) + result

print(ColIdxToXlName(int(input())))

Submission status: Accepted

Solution code:
def func(tmp):
  ans = ''
  sub_ans = (tmp-1)/26
  if int(sub_ans) >0:
      ans += func(int(sub_ans))
  if (tmp-1) <= 0:
    ans+='a'
  else:
  	ans += chr(97 + int(tmp-1)%26)
  return ans

  
tmp = int(input())
print(func(tmp))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

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


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

Submission status: Accepted

Solution code:
n=int(input())-1
al=['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=[]
m=n
k=1
while m>=26**k:
    m-=26**k
    k+=1
for i in range (k):
    ans.append(al[m%26])
    m=(m-m%26)//26
if k==1:
    print(ans[0])
elif k==2:
    print(ans[1]+ans[0])
elif k==3:
    print(ans[2]+ans[1]+ans[0])
elif k==4:
    print(ans[3]+ans[2]+ans[1]+ans[0])
elif k==5:
    print(ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==6:
    print(ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==7:
    print(ans[6]+ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==8:
    print(ans[7]+ans[6]+ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==9:
    print(ans[8]+ans[7]+ans[6]+ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==10:
    print(ans[9]+ans[8]+ans[7]+ans[6]+ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])
elif k==11:
    print(ans[10]+ans[9]+ans[8]+ans[7]+ans[6]+ans[5]+ans[4]+ans[3]+ans[2]+ans[1]+ans[0])

Submission status: Accepted

Solution code:
n = int(input())

a1 = 26**1
a2 = 26**2
a3 = 26**3
a4 = 26**4
a5 = 26**5
a6 = 26**6
a7 = 26**7
a8 = 26**8
a9 = 26**9
a10 = 26**10
a11 = 26**11
a12 = 26**12

b1 = a1
b2 = a1+a2
b3 = a1+a2+a3
b4 = a1+a2+a3+a4
b5 = a1+a2+a3+a4+a5
b6 = a1+a2+a3+a4+a5+a6
b7 = a1+a2+a3+a4+a5+a6+a7
b8 = a1+a2+a3+a4+a5+a6+a7+a8
b9 = a1+a2+a3+a4+a5+a6+a7+a8+a9
b10 = a1+a2+a3+a4+a5+a6+a7+a8+a9+a10
b11 = a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11
b12 = a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12

b = [b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12]
c = ['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 = ''
e = []
     
if n <= b1:
    i = 1
elif b1 < n <= b2:
    i = 2
elif b2 < n <= b3:
    i = 3
elif b3 < n <= b4:
    i = 4
elif b4 < n <= b5:
    i = 5
elif b5 < n <= b6:
    i = 6
elif b6 < n <= b7:
    i = 7
elif b7 < n <= b8:
    i = 8
elif b8 < n <= b9:
    i = 9
elif b9 < n <= b10:
    i = 10
elif b10 < n <= b11:
    i = 11
elif b11 < n:
    i = 12


for j in range (i):
    if n % 26 == 0:
        f = n % 26
        e.append(f)
        n = n // 26 -1
    elif n % 26 != 0:
        f = n % 26
        e.append(f)
        n = n // 26

for  k in range(i,0,-1):
    s = s + c[e[k-1]-1]

print(s)

Submission status: Accepted

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    a = "zabcdefghijklmnopqrstuvwxy"
    N = int(input())
    # if N <= 26:
    #     print(a[N%26])
    #     return

    ans = []
    d = 1
    m = 26
    while N != 0:
        tmp = (N % m)
        ans.append(a[tmp//d])
        N -= tmp if tmp != 0 else m
        d *= 26
        m *= 26
    
    ans.reverse()
    print(''.join(ans))

main()

Submission status: Accepted

Solution code:
import math

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    l = ''
    while N:
        if N%26:
            tmp = N%26
            N //= 26
        else:
            tmp = 26
            N //= 26
            N -= 1
        l += chr(96+tmp)
    print(l[::-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())-1
ans=''
X=26
i=1
while N>X**i-1:
  N-=X**i
  i+=1
for ii in range(i):
  n=N%X
  N=N//X
  ans=chr(n+97)+ans
print(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)

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

Submission status: Accepted

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

a = []
b = list('abcdefghijklmnopqrstuvwxyz')

if n <= 25:
    print(b[n])
    exit()
count = 0
for i in range(1,100):
    if n >= 26 ** i:
        n = n - 26 ** i
        count += 1
    else:
        break


#print(n,count,n // (26 ** A5))
count2 = 0


while 1:
    #print(n)
    #print(n,count,a)
    if count == 0:
        a.append(n)
        break
    count2 = n // (26 ** count)
    n = n % 26 ** count
    a.append(count2)
    count -= 1

#print(n)
x = [b[a[i]]for i in range(len(a))]
print("".join(x))

Submission status: Accepted

Solution code:
a=[chr(i) for i in range(97,97+26)]
n=int(input())
c=26
count=1
while 1:
  if n<=c:
    nn=(n-1)%c
    break
  else:
    n-=c
    c*=26
    count+=1
aa=[]
while count>0:
  aa.append(int(nn))
  nn=int(nn/26)
  count-=1
aa=aa[::-1]
ans=[]
cc=26
for i in aa:
  ans.append(a[int(i%cc)])
  i/=26
print("".join(ans))

Submission status: Accepted

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

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()

def main():
    N=ii()

    k = N
    ans = []
    a_ord = ord('a')

    def mod(n):
        return n%26 if n % 26 > 0 else 26


    while k > 0:
        # print(k%26)
        ans.append(chr(a_ord+mod(k)-1))
        if k % 26 > 0:
            k //= 26
        else:
            k -= 1
            k //= 26

    # if N % 26 == 0:
    #     print("".join(ans[::-2]))
    # else:
    print("".join(ans[::-1]))


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
n = int(input())

l = []
while True:
    if n%26 == 0:
        l.append(26)
        n = n//26 - 1
    else:
        l.append(n % 26)
        n //= 26
    if n == 0:
        break
    
ans = []
for v in l:
    ans.append(chr(v + 96))

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

Submission status: Accepted

Solution code:
def colnum_string(n):
    string = ""
    while n > 0:
        n, remainder = divmod(n - 1, 26)
        string = chr(65 + remainder) + string
    return string.lower()
n=int(input())
print(colnum_string(n))

Submission status: Accepted

Solution code:
N = int(input())

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']
mm = 1
name = ''
while True:
    if N > 26 ** mm:
        N = N - 26 ** mm
        mm += 1
    else:
        break
#mmけた

for i in range(mm):
    
    

    if N< 1:
        name =  'a' +name
    else:
            if N%26 == 0:
                name = alphabet[25] + name
                N = N//26
            else:
                name = alphabet[N%26-1] + name
                N = N//26 +1
print(name)

Submission status: Accepted

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

while(1):
    if(N%26 == 0):
        ans.append(N%26) #その時の桁数
        N = int(N/26) -1#残り
    else:
        ans.append(N%26) #その時の桁数
        N = int(N/26) #残り
    #0になったら
    if N == 0:
        break
        
A = ""
ans.reverse()

for i in ans:
    if i == 0:
        A += 'z'
    else:
        A += ABC[i-1]
        
print(A)

Submission status: Accepted

Solution code:
n = int(input())
alpha = "zabcdefghijklmnopqrstuvwxyz"
ans = ""
i = 1
while n!= 0:
    flag = False
    ans += alpha[n%26]
    if n%26 == 0:
        flag = True
    n //= 26 
    n -= flag
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
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 sys
input = sys.stdin.readline

n = int(input())
name = []
hantei = [1,27,703,18279,475255,12356631,321272407,8353082583,217180147159,5646683826135,146813779479511,3817158266467287]

for i in range(len(hantei)-1):
    if hantei[i] <= n < hantei[i+1]:
        n -= hantei[i]
        while n > 0:
            name.insert(0,n%26)
            n //= 26
        while i+1 > len(name):
            name.insert(0,0)

name = [chr(ord('a')+i) for i in name]

print("".join(name))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

modl = []

while n > 26:
    n, mod = divmod(n,26)
    if mod == 0:
        mod = 26
        n = n-1
    modl.append(mod)

modl.reverse()

print( chr(n+96),*[chr(i+96) for i in modl] ,sep="")