Problem:


Score : 300 points

Problem Statement

1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:

the dogs numbered 1,2,\cdots,26 were respectively given the names a, b, ..., z;

the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names aa, ab, ac, ..., zy, zz;

the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names aaa, aab, aac, ..., zzy, zzz;

the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;

the dogs numbered 475255,475256,\cdots  were respectively given the names aaaaa, aaaab, ...;

and so on.

To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:

a, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...

Now, Roger asks you:

"What is the name for the dog numbered N?"

Constraints

N is an integer.

 1 \leq N \leq 1000000000000001

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer to Roger's question as a string consisting of lowercase English letters.

Sample Input 1

2

Sample Output 1

b

Sample Input 2

27

Sample Output 2

aa

Sample Input 3

123456789

Sample Output 3

jjddja



Sample input:
2


Sample output:
b

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
i = 1
while n > 0 :
    x = n % 26
    if x != 0:
        ans += chr(x+96)
    else:
        ans += 'z'
        n -= 1
    n = n//26
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,12):
    num = (26**i)
    ans += num
    if ans == n:
        print("z"*i)
        exit()
res1,res2 = divmod(n,26)
res = ""
if res1 < 1:
    res = chr(res2+96)
elif res1>26:
    while n>0:
        div,mod = divmod(n,26)
        if mod==0:
            res += 'z'
            n = (n//26)-1
        else:
            res += chr(mod+96)
            n //= 26 
    res = res[::-1]
else:
    res += chr(res1+96)+chr(res2+96) if res2>0 else chr(res1+95)+"z"
print(res)

Submission status: Accepted

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


l=[0]
s=0

for i in range(1,20):
    s+=26**i
    l.append(s)
    if N <= s:
        break
x=N-l[-2]-1

ans=[0]*i
for j in range(i):
    q=x//26
    r=x%26
    x=q
    ans[-(j+1)]=alp[r]
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=""
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","z"]
ans=""
while n>0:
    ans=l[(n%26)]+ans
    if n%26==0:
        n-=1
    n//=26
print(ans)

Submission status: Accepted

Solution code:
import string

N = int(input())
al = string.ascii_lowercase

s = ''
num = 26
while N > 26:
    amari = N % num
    N //= 26
    if (amari == 0):
        N -= 1
    if (amari == 0):
        s += al[25]
    else:
        s += al[amari - 1]
if (N == 0):
    s += al[25]
else:
    s += al[N - 1]
print(s[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import bisect_left
n = int(input())
lis = [0]*13
for i in range(1,13):
   lis[i] = 26**i + lis[i-1]
#print(lis)
num = bisect_left(lis,n)
n -= lis[num-1]
n -= 1
ans = ''
for i in range(num):
   i = num-i-1
   ans += chr(n//(26**i) +97)
   n %= 26**i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

alp = 'abcdefghijklmnopqrstuvwxyz'

num = [26**i for i in range(1, 15)]

n1 = 0
n2 = 0

for i, n in enumerate(num):
    n1 += n
    if n1 >= N:
        n3 = N - n2
        k = i + 1
        break
    n2 = n1

ans = ''

if n3 % 26 == 0:
    n3 = n3-1
    for i in range(k):
        i = k-i-1
        if i == 0:
            ans += 'z'
            break
        if  n3 == 26**(i+1):
            ans += 'z'*(i+1)
            break
        n = n3 // 26**i
        n3 %= 26**i
        ans += alp[n]
else:        
    for i in range(k):
        i = k-i-1
        if i == 0:
            ans += alp[n3-1]
            break
        if  n3 == 26**(i+1):
            ans += 'z'*(i+1)
            break
        n = n3 // 26**i
        n3 %= 26**i
        ans += alp[n]

print(ans)

Submission status: Accepted

Solution code:
def base_convert(nl, ibase, obase):
    o = []
    while any(nl):
        c = 0
        for i in range(len(nl)):
            c = c * ibase + nl[i]
            nl[i], c = divmod(c, obase)
        o.append(c)
    o.reverse()
    return o


N = list(str(int(input())))
N = list(map(int, N))
p = base_convert(N, 10, 26)

ans = []
for _ in range(len(p)):
    for i in range(len(p)):
        if p[i] == 0 and i != 0:
            p[i - 1] -= 1
            p[i] = 26


pp = []
for i in range(len(p)):
    if p[i] != 0:
        pp.append(p[i])

ans = [chr(ord("a") + i - 1) for i in pp]
print("".join(ans))

Submission status: Accepted

Solution code:
N=int(input())
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"]
Ans=[]
s=0
for i in range(11):
    s+=26**i
    S=s+26**(i+1)
    if s<=N<S:
        I=i
        break
for i in range(I+1):
    N-=26**i
while I>=0:
    for i in range(0,26):
        n=N-26**I*i
        if n<26**I:
            Ans.append(l[i])
            N=n
            I-=1
            break
print("".join(Ans))

Submission status: Accepted

Solution code:
n = int(input())
s = [chr(i) for i in range(97, 97+26)]

out = ''
tmp = n
r = 1
c = 0
count = 1
while True:
    r *= 26
    # c += r
    # print(c)
    if tmp > c+r:
        c += r
        count += 1
    else:
        break

tmp = n - c - 1
# print(tmp)
# out = s[tmp%27-1]
# tmp = int(tmp/27)
while tmp>0:
    out = s[tmp%26]+out
    tmp = int(tmp/26)
# out = s[tmp%26-1]+out
for _ in range(count-len(out)):
    out = 'a'+out

print(out)

Submission status: Accepted

Solution code:
n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
# if l.count(0) == x:
#     print("z"*x)
#     exit()
# for i in range(len(l)):
#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 26
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))

Submission status: Accepted

Solution code:
list = [0,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
num_list =[0]
for i in range(1,15):
    num_list.append(26**i+num_list[i-1])

n = int(input())
i = 0
while True:
    if num_list[i] >= n:
        break
    else:
        i +=1


word = []
for j in range(i,0,-1):
    x = n//26**(j-1)
    if x==27:
        word.append(26)
        n = n -26**(j-1)*(n//26**(j-1))+26**(j-1)
    else:
        word.append(x)
        n = n -26**(j-1)*(n//26**(j-1))
while True:
    if 0 in word:
        p = word.index(0)
        word[p-1] = word[p-1]-1
        word[p] = 26
    else:
        break
h =''
for k in range(len(word)):
    h+=str(list[word[k]])
print(h)

Submission status: Accepted

Solution code:
"""
クアドリアンとダルメシアン（自然言語）
入力：自然数N
出力：a-zを使用した文字列
手続き
1. 入力を受け取る
2. N-1を26で割った商をd, 余りをrとする
3. 文字列a-zの内r番目の文字列をresに格納する
4. Nにdを代入して，手続き2.に戻る
5. resに格納した文字列を反転させ，出力する
"""
import string
N = int(input())
def convert_26_decimal(N):
    res = ""
    d, r = 0, 0
    while N:
        d, r = (N-1)//26, (N-1)%26
        res += string.ascii_lowercase[r]
        N = d
    return res[::-1]
print(convert_26_decimal(N))

Submission status: Accepted

Solution code:
n = int(input())
l = [0]
ans = []
a = 0
cur = 1
while a < 1000000000000001:
  a += 26**cur
  cur += 1
  l.append(a)
l = list(reversed(l))
for i in range(len(l)-1):
  if l[i] >= n:
    ans.append(0)
  else:
    div = min((n-l[i+1]-1)//(l[i]-l[i+1]),26)
    n = n-div*(l[i]-l[i+1])
    ans.append(div)
ans.append(n)
ans =list(map(lambda x:x+96, ans))
for i in range(len(ans)):
  if ans[i] > 96:
    ans2 = ans[i:]
    break
ans2 = "".join([chr(i) for i in ans2])
print(ans2)

Submission status: Accepted

Solution code:
import math
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"]

def kyusu(n):
    return 26 * (26 ** n - 1) / 25

t = 1
while(N > kyusu(t)):
    t += 1

keta = []
for i in range(t - 1):
    base = 26 ** (t - i - 1)
    extra = kyusu(t - i - 1)
    tmp = math.ceil((N - extra) / base)
    keta.append(alphabet[tmp - 1].lower())
    N -= base * tmp

answer = ""
for i in range(len(keta)):
    answer += keta[i]

answer += alphabet[N - 1].lower()
print(answer)

Submission status: Accepted

Solution code:
import string

N = int(input())
al = string.ascii_lowercase

# if (N >= 1 and N <= 26):
#     print(al[N - 1])
#     exit()
# elif (N >= 27 and N <= 702):
#     n = N // 26
#     amari = N % 26
#     if (amari == 0 and n != 27):
#         print(al[n - 1] + al[25])
#         exit()
#     elif (amari == 0 and n == 27):
#         print(al[25] + al[25])
#         exit()
#     else:
#         print(al[n - 1] + al[amari - 1])
#         exit()
# elif (N >= 703):
s = ''
num = 26
while N > 26:
    amari = N % num
    N //= 26
    if (amari == 0):
        N -= 1
    if (amari == 0):
        s += al[25]
    else:
        s += al[amari - 1]
if (N == 0):
    s += al[25]
else:
    s += al[N - 1]
print(s[::-1])

Submission status: Accepted

Solution code:
n = int(input())
res = n % 26

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

ans = []
while n//26 > 0 :
  res = n % 26
  if res != 0:
    ans.append(A[res-1])
    n = n // 26
  elif res == 0:
    ans .append(A[25])
    n = n // 26 -1

if n != 0:
  ans.append(A[n-1])

print(*ans[::-1], sep='')

Submission status: Accepted

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())

    def convert_to_alpha(num):
        return chr(ord('a') + num - 1)    # num は 1 - 25
    
    n = ii()
    memo = [pow(26, i+1) for i in range(20)]
    accum = list(accumulate(memo))
    least = list(accumulate([pow(26, i) for i in range(20)]))
    digit = 0
    for i in range(20):
        if accum[i] >= n:
            digit = i
            break
    L = []
    # [0], ..., [digit] までアルファベットが入る
    for i in range(digit, -1, -1):
        # print(f"{L} {n} {i}")
        if i == 0:
            assert 1 <= n <= 26
            if n == 26:
                L.append('z')
            else:
                L.append(convert_to_alpha(n))
            break
        # pow(26, i) to pow(26, i+1) だけど
        assert accum[i-1] <= n <= accum[i]
        if n >= pow(26, i+1) + least[i-1]:
            L.append('z')
            n -= pow(26, i+1)
        else:
            q = (n - least[i-1]) // pow(26, i)
            res = n - q * pow(26, i)
            if res < least[i-1]:
                q -= 1
            if q == 26:
                L.append('z')
            else:
                L.append(convert_to_alpha(q))
            n = res
        


    print(''.join(L))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

n -= 1

cnt = 1
num = 26
name = ''
anum = 97

while n >= num:
    name += chr(n%num+anum)
    n = int(n/26)
    n -= 1

name += chr(n%num+anum)

name = name[::-1]

print(name)

Submission status: Accepted

Solution code:
N = int(input())
c = 0
P = [N]

alph = {}
p = 1
for i in range(97, 97+26):
    alph[str(p%26)] = chr(i)
    p += 1

ans = []
k = 0
T = N
while(N > 0):
    if k == 0:
        ans.append(alph[str((N // (26**k))%26)])
    else:
        ans.append(alph[str(((N-1)//(26**k)+1)%26)])
    k += 1
    N -= 26**k
print("".join(ans[::-1]))

Submission status: Accepted

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

num = []

while n >= 26:
    num.append(n % 26)
    n = n // 26 - 1

num.append(n)
num.reverse()

ans = []
for numi in num:
    ans.append(chr(numi + 97))

print(''.join(ans))

Submission status: Accepted

Solution code:
X = input()
a = ""
y = int(X)
while y > 0:
    i = int(y % 26)
    if i == 0:
        a = "z" + a
        y = y - 26
    else:
        a ='abcdefghijklmnopqrstuvwxy'[i-1] + a
        y = y - i
    y = y / 26
print (a)

Submission status: Accepted

Solution code:
"""
    Satwik_Tiwari ;) .
    20 june , 2020  - Tuesday
"""

#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase


import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
#If the element is already present in the list,
# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect
#If the element is already present in the list,
# the right most position where element has to be inserted is returned

#==============================================================================================

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

# inp = lambda: sys.stdin.readline().rstrip("\r\n")

#===============================================================================================
#some shortcuts

mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def out(var): sys.stdout.write(str(var))  #for fast output, always take string
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n")  #as stdout.write always print sring.
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(a,b):
    ans = 1
    while(b>0):
        if(b%2==1):
            ans*=a
        a*=a
        b//=2
    return ans
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) : # Check Prime Number or not
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

#===============================================================================================
# code here ;))

def base(n,x):
    a = []
    while(n!=0):
        a.append((n%26))
        n = n//26

    if(len(a) < x):
        while(len(a) !=x):
            a.append(0)
    a = a[::-1]
    return a

def solve():
    n = int(inp())
    a = []
    for i in range(1,27):
        a.append(chr(96+i))

    x = 1
    rem = 0
    while((26**x)+rem < n):
        rem+=26**x
        x+=1
        # print(rem)


    n = n - rem
    temp = base(n-1,x)
    # print(temp,x,n)
    ans =''
    for i in range(0,len(temp)):
        ans += a[temp[i]]
    print(ans)


testcase(1)
# testcase(int(inp()))

Submission status: Accepted

Solution code:
def change_n_shinsu(x, n):
    ans = []
    while True:
        shou = x // n
        amari = x % n
        if shou == 0 and amari == 0:
            break
        ans.append(amari)
        x = shou
    # ans = ans.zfill(k)
    return ans

n = int(input())

lst = [26]
for i in range(100):
    lst.append(lst[-1]*26)

ruiseki = [26]
for i in range(1, 100):
    ruiseki.append(ruiseki[-1]+lst[i])

keta = 1
while n > ruiseki[keta-1]:
    keta += 1

if keta == 1:
    print(chr(n+ord('a')-1))
    exit()

n -= ruiseki[keta-2]+1

sin = change_n_shinsu(n, 26)
while len(sin) < keta:
    sin.append(0)
sin = sin[::-1]

ans = ''
for i in range(keta):
    ans += chr(sin[i]+ord('a'))

print(ans)

Submission status: Accepted

Solution code:
import sys, re
import math
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-
n = INT()
alphabet = "abcdefghijklmnopqrstuvwxyz"
ans = ""

def A(value):
    global alphabet, ans
    if value <= 26:
        ans += alphabet[value - 1]
        print(ans[::-1])
    else:
        a = value % 26
        ans += alphabet[a - 1]
        if a == 0:
            A( math.floor(Decimal(value - 2) / Decimal(26)) )
        else:
            A( math.floor(Decimal(value) / Decimal(26)) )
A(n)

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    X_dumy = X-1
    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']
    out = []
    while X_dumy>=0:
      out.insert(0,alpha[(X_dumy%n)])
      X_dumy = int(X_dumy/n)-1
    return out

N=int(input())
c=Base_10_to_n(N,26)
c=''.join(c)
print(c)

Submission status: Accepted

Solution code:
N = int(input())
name = ""
tempN = N
while tempN > 0:
    num = tempN % 26
    if num == 0:
        num = 26
    name += chr(num + 96)
    tempN = (tempN - num)//26

print(name[::-1])

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())
ans = []

while N > 26:
    if N % 26 == 0:
        ans.insert(0,chr(122))
        N = N // 26-1
    else:
        ans.insert(0,chr(N%26+96))
        N = N // 26
ans.insert(0,chr(N+96))

print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())

fase = 0
idx = 0
for i in range(1, 20):
  N -= 26**i
  if N <= 0:
    fase = i
    idx = 26**i - abs(N)
    break

ans = ''
for i in range(1, fase+1):
  q = idx / (26**(fase-i))
  mod = idx % (26**(fase-i))
  if mod == 0:
    mod = 26**(fase-i)
  if q <= 1:
    ans += 'a'
  elif q <= 2:
    ans += 'b'
  elif q <= 3:
    ans += 'c'
  elif q <= 4:
    ans += 'd'
  elif q <= 5:
    ans += 'e'
  elif q <= 6:
    ans += 'f'
  elif q <= 7:
    ans += 'g'
  elif q <= 8:
    ans += 'h'
  elif q <= 9:
    ans += 'i'
  elif q <= 10:
    ans += 'j'
  elif q <= 11:
    ans += 'k'
  elif q <= 12:
    ans += 'l'
  elif q <= 13:
    ans += 'm'
  elif q <= 14:
    ans += 'n'
  elif q <= 15:
    ans += 'o'
  elif q <= 16:
    ans += 'p'
  elif q <= 17:
    ans += 'q'
  elif q <= 18:
    ans += 'r'
  elif q <= 19:
    ans += 's'
  elif q <= 20:
    ans += 't'
  elif q <= 21:
    ans += 'u'
  elif q <= 22:
    ans += 'v'
  elif q <= 23:
    ans += 'w'
  elif q <= 24:
    ans += 'x'
  elif q <= 25:
    ans += 'y'
  elif q <= 26:
    ans += 'z'
  idx = mod

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
alphabet = "zabcdefghijklmnopqrstuvwxy"
num = N
cnt = 0
div = 26
res = ""
while True:
  # print(num, div)
  sho = num // div
  amari = num % div
  # print(sho, amari, alphabet[amari])
  # print("--")
  res += alphabet[amari]
  if amari != 0:
    num = sho
  else:
    num = sho -1
  if sho == 0:
    break
  elif sho == 1 and amari == 0 and alphabet[amari] == "z":
    break
print(res[::-1])

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    ans = ""

    while n > 0:
        r = n % 26
        ans += chr((r - 1) % 26 + ord('a'))
        n //= 26
        if r == 0:
            n -= 1
    print(ans[::-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
alpha = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())
ans =''
a = []
while n > 0:
    t = n%26-1
    if t < 0:
        t = 25
    a.append(t)
    n -= t+1
    n //= 26
a.reverse()
for i in a:
    ans += alpha[i]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

a=0
b=-1
c=[]
while b!=0:
  a=n%26
  b=n//26
  n=b
  
  c.append(a)

for i in range(0,len(c)-1):
  if c[i]==0 or c[i]==-1:
    c[i]+=26
    c[i+1]-=1


ss=""
for i in reversed(range(len(c))):
  if ss=="" and c[i]==0:
    continue
  ss+=chr(96+c[i])
  
print(ss)

Submission status: Accepted

Solution code:
N = int(input())
al=[chr(ord('a') + i) for i in range(26)]
out = []
while N>=1:
    X = N%26
    out.append(X-1)
    if X==0:
        N = (N-26)//26
    else:
        N = (N-X)//26
S = ""
for i in range(len(out)):
    S += al[out[len(out)-1-i]]
print(S)

Submission status: Accepted

Solution code:
N = int(input())
alphabet_lst = list('abcdefghijklmnopqrstuvwxyz')
#print(alphabet_lst)

keta = 0
keta_lst = []
sum_lst = []
while N>=sum(keta_lst):
    keta_lst.append(26**keta)
    sum_keta = sum(keta_lst)
    sum_lst.append(sum_keta)
    keta += 1
    
keta -= 1
keta_lst = keta_lst[:keta]
#print(keta_lst)
#print(keta)

ans_lst = []
for i in range(keta):
    ans_n = (N - sum(keta_lst[:-(i+1)])) // keta_lst[-(i+1)]
    #print(ans_n)
    #print(keta_lst[-(i+1)])
    N -= ans_n*keta_lst[-(i+1)]
    ans_lst.append(alphabet_lst[ans_n-1])

for i in range(keta):
    print(ans_lst[i],end="")

Submission status: Accepted

Solution code:
N = int(input())
line = [ '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']
output =""
while True:
    if N == 0:
        break
    if (int(N/26)):
        output = line[(N%26) -1] + output
        if N%26 == 0:
            N = int((N-1)/26)
        else:
            N = int(N/26)
    
    else:
        output = line[(N%26) -1] + output
        break
print(output)

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
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' ]
order = 0
def func(m):
    return int(26 * (26**m-1) / 25 + 0.5)
# print(func(12))
for i in range(11, 0, -1):
    if n > func(i):
        n = n-func(i)
        order = i
        break
for i in range(order, 0, -1):
    if n % 26**i == 0:
        m = n//(26**i) - 1
        n -= m * 26 ** i
        ans += alf[m]
    # print(n)
    # print(m)
    else:
        m = n // 26**i
        n %= 26**i
        ans += alf[m]
ans += alf[n-1]
print(ans)

Submission status: Accepted

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

    ans = []
    while n > 0:
        n, mod = divmod(n, 26)
        if mod == 0:
            ans.append(26)
            n -= 1
        else:
            ans.append(mod)

    ans.reverse()

    for i in range(len(ans)):
        if ans[i] == 0:
            pass
        else:
            print(chr(96+ans[i]), end='')
    print()

resolve()

Submission status: Accepted

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

res = n-d[i]
for i in range(i+1):
    r = res//(26**i)
    ans += a[(r%26)]
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
ans = []
i = 1
while True:
    if N > 26 ** i:
        N -= 26 ** i
        i += 1
    else:
        break

N = N-1


for j in range(i):
    a = N // (26 ** (i-j-1))
    ans.append(a)
    N -= (26 ** (i-j-1)) * a

ch = ['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']
dic = {}
for i in range(26):
    dic[i+1] = ch[i]

for i in range(len(ans)):
    ans[i] = dic[ans[i]+1]

print(''.join(ans))

Submission status: Accepted

Solution code:
import copy
N = int(input())
keta = 1
n = copy.deepcopy(N)
flag = True
while flag:
    if n-1 >= 26**keta:
        n -= 26**keta
        keta += 1
    else:
        flag = False
for i in range(1, keta):
    N -= 26**i
alph = 'abcdefghijklmnopqrstuvwxyz'
ans = []
ans.append(alph[(N%26)-1])
for i in range(1, keta):
    num = (N-1)//(26**i)
    if num ==0:
        ans.append("a")
    else:
        ans.append(alph[(num%26)])
ans.reverse()
print("".join(ans))