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:
import math

def main():
    N = int(input())
    lowercase = 'abcdefghijklmnopqrstuvwxyz'
    ans = ''
    for i in range(len(str(N))):
        j = N % 26
        if N == 0:
            break
        if j == 0:
            N = N // 26 - 1
        else:
            N = N // 26
        ans = lowercase[j-1] + ans
        # print(N, j-1, ans)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

while (n != 0):
    s = n // 26
    t = n % 26
    if (t == 0):
        s -= 1
        t += 26
    p = string.ascii_lowercase[t-1]
    ans = p+ans
    n = s
print(ans)

Submission status: Accepted

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

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

exponent = 1
res = n
lst = [alphabet[res % 26]]
res //= 26
while res != 0:
    res -= 1
    lst.append(alphabet[res % 26])
    res //= 26

lst.reverse()
print("".join(lst))

Submission status: Accepted

Solution code:
# 番号Nを26進数で表現すればいいはず？

def convert_base_number(new_base, target) :
    result = []

    while True :
        dig = target % new_base
        target = target // new_base
        result.append(dig)

        if (target == 0) :
            break

        # if (target < new_base) :
        #     if (target != 0) :
        #         result.append(target)
        #     break

    return result

# def convert_base_number(new_base, target, result) :
#     X_dumy = target
#     out = ''
#     while X_dumy>0:
#         out = str(X_dumy%new_base)+out
#         result.append(str(X_dumy%new_base))
#         X_dumy = int(X_dumy/new_base)
#     return out

# アルファベットの何番目の数字を返す
def get_alpha(number) :
    base = ord('a')
    return chr(base + number)

# https://tanuhack.com/num2alpha-alpha2num/#i-3
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())
    # converted = []
    # # convert_base_number(26, N, converted)
    # converted = convert_base_number(26, N-1)
    # # converted = convert_base_number(26, N)
    # print(converted)

    # # out_str = get_alpha(converted[0]-1)
    # out_str =''
    # # for conv in converted[1:] :
    # for conv in converted :
    #     out_str += get_alpha(conv)
    
    # print(out_str)


main()

Submission status: Accepted

Solution code:
n=int(input())
l=1
c=1
while(1):
    c+=26**l
    if n/c<1:
        c-=26**l
        break
    else:
        l+=1

S = list('abcdefghijklmnopqrstuvwxyz')
tmp_n=n-c
tmp=0
tmp_ans=[]
for i in range(l):
    tmp = (tmp_n)//26**((l-1)-i)
    tmp_n -= tmp*26**(l-1-i)
    tmp_ans.append(S[tmp])
print("".join(tmp_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())
print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
import sys

class alphabet: #Trueなら大文字
    def __init__(self, capitalize):
        self.num = dict() #アルファベットを数字に変換
        self.abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"\
            ,"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc): self.num[a] = i


def solve():
    input = sys.stdin.readline
    N = int(input())
    AB = alphabet(False)
    Ans = ""
    while N > 0:
        N -= 1
        Ans = AB.abc[N % 26] + Ans
        N //= 26
        
    
    print(Ans)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
S = "_abcdefghijklmnopqrstuvwxyz"
ans = ""
while N > 0:
    if N%26 != 0:
        ans += S[N%26]
    else:
        ans += "z"
        N -= 1
    N = N//26

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
char = [i for i in range(97, 97+26)]
a_n = 96
base = 26
base_list = []
ans = ''

while N > 0:
    add = N % 26
    if add==0:
        add=26
    ans += chr(a_n+add)
    N = (N-1) // 26
#     # base_list += [base]
#     # base = base + base*26

# base = 26
# # cumsum = 0
# for b in enumerate(base_list):
#     ans += chr(a_n+(N%base))
#     N = (N-base)
#     base = base*26
#     # print(N)
# ans += chr(a_n+N%base)
# print(base_list)
print(ans[::-1])
# if N <

Submission status: Accepted

Solution code:
num = 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(num).lower())

Submission status: Accepted

Solution code:
n = int(input())
ans = []
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())

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:
string = 'abcdefghijklmnopqrstuvwxyz'

num = int(input())
ans = ""
while num != 0:
    num, m = divmod(num, 26)
    if m == 0:
        ans = string[m-1] + ans
        num = num - 1
    else:
        ans = string[m-1] + ans

print(ans)

Submission status: Accepted

Solution code:
def Quadrillion():

    Num = int(input())

    moji = num2alpha(Num)

    print(moji)

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)

if __name__ == '__main__':
    Quadrillion()

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:
n = int(input())
n=n-1
def f(n):
    q, mod = divmod(n,26)
    if q==0:
        return chr(97+mod)
    return f(q-1)+chr(97+mod)
print(f(n))

Submission status: Accepted

Solution code:
num=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(num)
print(str.lower(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)

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

Submission status: Accepted

Solution code:
N = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"

count = 1
n = 26
while n < N:
    count += 1
    n = (n + 1) * 26

# (count-1)桁までの個数
minues = 0
for i in range(count):
    minues += 26**i

# count桁で何番目か
answer_index = []
N -= minues
while count>0:
    answer_index.append(N%26)
    count -=1
    N //= 26

answer_list = []
for idx in reversed(answer_index):
    answer_list.append(alphabet[idx])

print("".join(answer_list))

Submission status: Accepted

Solution code:
import sys, math



if(__name__ == "__main__"):

    """
    26^2 = 676 -> 676+26 = 702: 2文字の最大値
    3文字の番号は26**3種類
    1文字のものが26 * 1, 2文字が26* (1+26), 3文字の最大値は26**3 + 27 * 26 = 26 * (27 + 26**2) = 36 * 703
    4文字の最大値は26 * 703 + 26**4 = 26 * (26**0 + 26**1 + 26**2 + 26**3) = 475254


    """

    N= int( input().strip() )

    Max_bef = 0
    Max = 1
    N_26 = N/26
    str_len = 1
    while(N_26 > Max):
        Max_bef = Max
        Max += 26**str_len
        str_len += 1
    Max_beforestr= Max_bef*26
    hash = N-Max_beforestr
    # hash = N
    namelist = ["z"]*str_len

    num = str_len-1
    num2alpha = lambda c: chr(c+64)
    """
    d = num2alpha(25)
    print( d )
    aa -> 1
    ab -> 2
    az -> 26

    aaa -> 1
    aaz -> 26
    aba -> 27
    """

    while( num >= 0):
        remainder = hash%26
        if(remainder==0):
            remainder = 26
        d = num2alpha(remainder).lower()
        namelist[num]= d
        hash = math.ceil(hash/26)

        num -= 1

    Str = ""
    for i in range(str_len):
        Str += namelist[i]
    print(Str)
    #print(N, str_len, hash, namelist)

Submission status: Accepted

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

    alphabet = list('abcdefghijklmnopqrstuvwxyz')
    name = []

    while True:
        if N % 26:
            res = N % 26
        else:
            res = 26

        name.append(alphabet[res-1])

        if N - res == 0:
            break
        else:
            N = (N - res) // 26
    
    print(''.join(name[::-1]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    N = int(readline())
    start = 1
    cnt = 1
    while True:
        last = start * 26
        if start <= N <= last:
            break
        start = last + 1
        cnt += 1
    
    idx = N - start  # その文字数の中で何番目か (0番目スタート)

    res = ""
    while cnt:
        chara = idx // 26 ** (cnt - 1)
        idx -= 26 ** (cnt - 1) * chara
        chara = alp[chara]
        res += chara
        cnt -= 1
    
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

N=int(input().rstrip('\n'))
alpha = [chr(i) for i in range(ord('a'), ord('z')+1)]
res = []
rest = N
for i in range(N):
  N1 = rest % 26
  rest = rest//26
  if N1>0:
    res.append(alpha[N1-1])
  else:
    res.append('z')
    rest -= 1
  if rest == 0:
    break
print(''.join(res[::-1]))

Submission status: Accepted

Solution code:
n = int(input())
lencnt = 1
lencut = 27
for i in range(1,12):
  if n<lencut:
    break
  else:
    lencnt += 1
    lencut = lencut+(26**lencnt)
ans = ""
rem = n
for i in range(lencnt,-1,-1):
  prevlencut = lencut-(26**i)
  quot = (rem-prevlencut)//(26**i)
  ans = ans + chr(quot+96)
  rem = rem-(quot*(26**i))
  lencut = int(prevlencut)
print(ans[1:])

Submission status: Accepted

Solution code:
n = int(input())

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

print(main(n))

Submission status: Accepted

Solution code:
N = int(input())
alpha = list('zabcdefghijklmnopqrstuvwxy')
ans = ''


def dfs(n):
    global ans
    if n <= 26:
        ans += alpha[n%26]
        return ans[::-1]
    else:
        ans += alpha[n % 26]
        if n % 26 == 0:
            nn = n // 26 - 1
        else:
            nn = n // 26
        return dfs(nn)

print(dfs(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    n = int(sys.stdin.readline())
    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())
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

swap_name = []
for i in range(len(name)):
    swap_name.append(swap(name[len(name)-i-1]))
print(*swap_name, sep="")

Submission status: Accepted

Solution code:
N=int(input())
n=N
c=1
while True:
  if n-26**c >0:
    n=n-26**c
    c+=1
  else:
    break
for i in range(1,c):
  N=N-26**i
Z=[]
N=N-1
for i in range(c-1):
  tmp = N // 26**(c-1-i)
  Z+=[tmp]
  N = N % 26**(c-1-i)
Z+=[N]
ans=""
for i in range(len(Z)):
  ans+=chr(97+Z[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

if n == 0:
  print('z' * i)
  exit()
ls = [chr(i) for i in range(97, 97+26)]
ans = ''
n = n + x - 1
x = int(x / 26)
while x >= 1:
  j = n // x
  n = n % x
  x = int(x/26)
  ans += ls[j]
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = []
while True:
    n -= 1
    t = n // 26
    s = n % 26

    l.append(chr(97+s))
    n = t
    if t == 0:
        break
l.reverse()
print(''.join(l))

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import pprint


sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	d = "abcdefghijklmnopqrstuvwxyz"
	s = []
	while n > 0:
		log.print(n // 26, n % 26)
		s.append(n % 26)
		if n % 26 == 0:
			n //= 26
			n -= 1
		else:
			n //= 26

	ans = ""
	for si in s[::-1]:
		ans += d[si - 1]
	print(ans)


main()

Submission status: Accepted

Solution code:
def check(mid,n):
    total = 26*(pow(26,mid)-1)//25
    if total <= n:
        return True

    return False

def find(n):
    low = 1
    high = 10
    x = 0
    while low <= high:
        mid = (low+high)//2
        if check(mid,n):
            x = mid
            low = mid+1
        else:
            high = mid-1

    return x

def find2(n,x,curr_len):
    low = 0
    high = 26
    while low <= high:
        mid = (low+high)//2
        if mid*pow(26,x-curr_len-1) < n:
            low = mid+1
            k = mid
        else:
            high = mid-1

    return k

def main():
    n = int(input())
    if n <= 26:
        print(chr(ord('a')+n-1))
        return
    
    ans = ''
    x = find(n)
    n -= 26*(pow(26,x)-1)//25
    if n == 0:
        for i in range(x):
            ans += 'z'
    else:
        x += 1
        #print(n)
        while len(ans) != x:
            k = find2(n,x,len(ans))
            if k == 0:
                ans += chr(ord('a')+k)
            else:
                ans += chr(ord('a')+k)
                n -= k*pow(26,x-len(ans))

            #print(ans,n,k)

    print(ans)
            
    
main()

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
# N = I()
# A = [LI() for _ in range(N)]


n = I()
s = 1
if n < 27:
    print(chr(96 + n))

else:
    while 26 ** s < n:
        n -= 26 ** s
        s += 1
    ans = ''
    n -= 1
    for i in range(s):

        k = n // 26**(s-i-1)
        ans = ans + chr(97 + k)
        n = n - k * 26**(s-i-1)



    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = list('abcdefghijklmnopqrstuvwxyz')
if N <= 26:
    print(L[N - 1])
    exit()

L = list('zabcdefghijklmnopqrstuvwxy')
ans_l = []


while (True):
    syou = N // 26
    amari = N % 26
    ans_l.append(L[amari])

    if amari == 0:
        N = syou - 1
    else:
        N = syou
    
    if N <= 26: break
    
if N == 26: N = 0
ans_l.append(L[N])

ans_l = ans_l[::-1]
print(*ans_l, sep="")

Submission status: Accepted

Solution code:
n = int(input())

_SUBBASE = 26
subtra = 26
divCnt = 0

while True:
    if n <= subtra:
        break
    n -= subtra
    subtra = subtra * _SUBBASE
    divCnt += 1

n -= 1

anslist = []
for _ in range(divCnt+1):
    anslist.append(n%26)
    n = n//26

anslist.reverse()
for ac in anslist:
    print(chr(ord('a') + ac), end="")
print()

Submission status: Accepted

Solution code:
N=int(input())

F=0
K=0

while F<N:
    F=(F*26)+26
    K+=1

N=N-F//26

S=""
for _ in range(K):
    S=chr(ord("a")+N%26)+S
    N//=26

print(S)

Submission status: Accepted

Solution code:
N = int(input())

# 桁数を決める
tmp = 0
digit = 1
tmp += pow(26, digit)
while N > tmp:
    digit += 1
    tmp += pow(26, digit)

order = N - (tmp - pow(26, digit)) - 1
X = [0] * digit
cur = digit - 1
while order > 0:
    X[cur] = order % 26
    order //= 26
    cur -= 1

# X = list(reversed(X))
# print(X)

a = ord('a')
ans = []
for x in X:
    c = chr(a + x)
    ans.append(c)

print(''.join(ans))

Submission status: Accepted

Solution code:
def _main(n):
    codes = "abcdefghijklmnopqrstuvwxyz"
    b = len(codes)
    values = ""
    while True:
        n -= 1
        values += codes[int(n % b)]
        n, mod = divmod(n, b)
        if n == 0:
            print(values[::-1])
            break


def _entry():
    n = int(input())
    _main(n)


if __name__ == "__main__":
    _entry()

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1000):
    if n > 26**(i+1):
        n -= 26**(i+1)
    else:
        break
x = i+1

t = 26**i
ans = ""
for i in range(x-1,-1,-1):
    t = 26**i
    for j in range(26):
        if n > t:
            n -= t
        else:
            ans += chr(ord("a")+j)
            break
print(ans)

Submission status: Accepted

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

    ans = ''
    while n > 0:
        t = n % 26
        t = 26 if t == 0 else t
        ans = chr(t + 96) + ans
        n = (n - 1) // 26
    print(ans)


if 'unittest' not in globals():
    resolve()

Submission status: Accepted

Solution code:
import string

N = int(input())

s = string.ascii_lowercase

n = N
l = []
append = l.append
while n != 0:
  a, b = (n - 1) // 26, n % 26
  append(s[b - 1])
  n = a

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

Submission status: Accepted

Solution code:
N = int(input().rstrip())
ret = []
while N != 0:
    char = chr(96 + (N % 26))
    if char == '`':
        char = 'z'
        N = N // 26 - 1
    else:
        N = N // 26
    ret.append(char)
print(''.join(ret[::-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())
ans = num2alpha(n).lower()
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = [chr(h) for h in range(97,97+26)]
i = 1
j1 = 0
j2 = 0
s = ""
while 1:
  j1 = j2 + 1
  j2 += 26 ** i
  if j1 <= n <= j2:
    break
  i += 1
n -= j1
for k in range(i):
  n1 = int(n%26)
  s = l[n1] + s
  n = (n-n1) / 26
print(s)

Submission status: Accepted

Solution code:
num = int(input())

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

print(conv(num))

Submission status: Accepted

Solution code:
n = int(input())
d = {k:v for k,v in zip(range(26),'abcdefghijklmnopqrstuvwxyz')}
i = 1
while n > 26**i:
    n -= 26**i
    i += 1
res = ''
n -= 1
for j in range(i-1,-1,-1):
    jn, n = divmod(n, 26**j)
    res += d[jn]
print(res)

Submission status: Accepted

Solution code:
n = int(input())

def f(n):
    n = n-1
    m = 'abcdefghijklmnopqrstuvwxyz'
    ans = ''
    if n // 26 == 0:
        ans += m[(n%26)]
        return ans
    ans += m[(n%26)]
    return f(n//26) + ans

print(f(n))

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())
a = N%26
next = int(N/26)
b = N%26
next = int(N/26)
a=[]
answer=[]
for i in range(20):
  if (N > 26) and (N%26)!=0:
    a.append(N%26)
    N = int(N/26)
  elif (N > 26) and (N%26)==0:
    a.append(26)
    N = int((N-1)/26)
  else:
    a.append(N)
    break
for i in range(len(a)):
  answer.append(chr(ord('a')+a[i]-1))
mojiretu = ' '
for x in reversed(answer):
    mojiretu += x
print(mojiretu)

Submission status: Accepted

Solution code:
n = int(input())


def cal(n):
    c = ord("a")
    l = ""
    b = n
    while b > 26:
        a = (b-1) % 26
        b = (b-a)//26
        l = l+chr(c+a)
    l = l+chr(c+b-1)
    print(l[::-1])


cal(n)

Submission status: Accepted

Solution code:
N = int(input())

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)

i = 0
sum = 0
while True:
    if N <= sum:
        sum -= 26 ** i
        break
    i += 1
    sum += 26 ** i

s = Base_10_to_n(N - sum - 1, 26)
s = list(s.split())
ans = ""
for st in s:
    ans = ans + chr(int(st) + 97)
plusa = "a" * (i - len(ans))
ans = plusa + ans
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans=''
t=1
while(N>0):
    s=N%26
    if s==0:
        s+=26
    ans+=chr(s+96)
    if s!=26:
        N//=26
    else:
        N-=1
        N//=26
    t+=1
print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
digit=0
for i in range(1,12):
    tmp=26**i
    if n<=tmp:
        digit=i
        break
    else:
        n-=tmp
# print(digit,n)
n-=1
ans=[]
for i in range(digit-1,-1,-1):
    tmp=26**i
    # print(n,tmp,n//tmp,n%tmp)
    ans.append(n//tmp)
    n%=tmp
# print(ans)
for ai in ans:
    print(chr(ai+97),end='')

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)+'z'
    else:
        return num2alpha(num//26)+chr(96+num%26)
print(num2alpha(N))

Submission status: Accepted

Solution code:
_dog_no = int(input())
_letter = [chr(i) for i in range(97,97+26)]
_dog_name = ""
for _i in range(11):
  _dog_no -= 1
  _dog_name = _letter[_dog_no % 26] + _dog_name
  _dog_no = _dog_no // 26
  if _dog_no < 1:
    break
print(_dog_name)

Submission status: Accepted

Solution code:
import string
str_map = {num+1: item for num, item in enumerate(string.ascii_lowercase)}
def main():
	n = int(input())
	ans = []
	while n > 26:
		tmp = 26 if n%26 == 0 else n%26
		ans.append(str_map[tmp])
		n = (n-1) // 26
	ans.append(str_map[n])
	ans_str = ''.join(ans)
	print(ans_str[::-1])
	return

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import sys
a=int(input())
c=0
i=0
if a==26:
  print("z")
  sys.exit()
if a==26+26**2:
  print("zz")
  sys.exit()
if a==26+26**2+26**3:
  print("zzz")
  sys.exit()
if a==26+26**2+26**3+26**4:
  print("zzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5:
  print("zzzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5+26**6:
  print("zzzzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5+26**6+26**7:
  print("zzzzzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5+26**6+26**7+26**8:
  print("zzzzzzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5+26**6+26**7+26**8+26**9:
  print("zzzzzzzzz")
  sys.exit()
if a==26+26**2+26**3+26**4+26**5+26**6+26**7+26**8+26**9+26**10:
  print("zzzzzzzzzz")
  sys.exit()
while c<=a:
  i+=1
  c+=26**i
l=[0]*i
p=0
for k in range(i):
  p+=26**k
a-=p
for j in range(i):
  l[j]=a//(26**(i-j-1))
  a=a%(26**(i-j-1))
for n in l:
  print(chr(n+97),end='')

Submission status: Accepted

Solution code:
from string import ascii_lowercase as lower
lower = list(lower)
n = int(input())
digit = 0
num = 0
while num < n:
    digit += 1
    num += 26**digit

num -= 26**digit
ans = [None]*digit
length = digit
while digit > 0 and num != n:
    for idx in range(26):
        new = num + 26**(digit-1)
        if new >= n:
            break

        else:
            num = new
    ans[length-digit] = lower[idx]
    digit -= 1

ans = [a if a is not None else 'a' for a in ans]
print(''.join(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)


X = num2alpha(n)
print(X.swapcase())

Submission status: Accepted

Solution code:
N = int(input())

ans = ''

while(1):
    a = (N-1) % 26
    ans += chr(97+a)

    N = (N - 1) // 26

    if N < 1:
        break

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

div = 26
ans = []

while 1:
    if N % 26 == 0:
        ans.append(26)
        N = N // div - 1
    else:
        amari = N % div
        ans.append(amari)
        N //= div
    if N == 0:
        break

ans.reverse()
name = []

for i in ans:
    name.append(chr(i+96))

print(''.join(name))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000000)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    k = []
    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']

    n -= 1
    while True:
        if n < 0:
            break
        _ = n % 26
        k.append(alpha[_])
        n = (n - _) // 26 - 1

    k.reverse()
    for i in k:
        print(i, end='')
    print('')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

n = 26
m = 1

while N > n:
    n = n * 26 + 26
    m += 1

e = n
result = ''

for i in range(m):
    a = N % 26
    if a == 0:
        a = 26
    result = chr(a + 96) + result
    N = (N - a) // 26

print(result)

Submission status: Accepted

Solution code:
import sys
N = int(input())

ans = ""

alp = "abcdefghijklmnopqrstuvwxyz"
#print (len(alp))

ns = 0
k = 0
ans = ""
for keta in range(1,100):

    os = ns
    ns += 26**keta

    if ns >= N:

        N -= (os + 1)
        #print (N)
        

        for i in range(keta-1,-1,-1):

            ans += alp[N // (26**i)]
            N %= 26**i

        print (ans)
        sys.exit()

Submission status: Accepted

Solution code:
def main():
    import string

    N = int(input())
    sb = []

    def rec(n):
        if 1 <= n <= 26:
            return string.ascii_lowercase[n-1]
        else:
            r = n%26
            q = n//26
            if r == 0:
                r = 26
                q -= 1
            return rec(q) + rec(r)

    print(rec(N))
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
def solve(n):
    if n<26:
        return [alp[n]]

    ans=[alp[(n%26)]]

    ans.extend(solve((n//26)-1))
    return ans


ans=solve(n-1)
ans.reverse()
print(*ans,sep="")

Submission status: Accepted

Solution code:
n = int(input())
i = 1
m = 0
alp = list(map(str,"abcdefghijklmnopqrstuvwxyz"))
ls = []
while True:
    if m + 26**i < n:
        m += 26**i
        i += 1
    else:
        break
ans = n-m
for ii in range(i):
    l = i-ii
    q = ans//(26**(l-1))
    if  ans/(26**(l-1)) % 1 != 0:
        q += 1
    ans -= q*(26**(l-1))
    ls.append(alp[q-1])
print("".join(ls))

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