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:
## necessary imports
import sys
input = sys.stdin.readline
#from math import ceil, floor, factorial;

# swap_array function
def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp

## gcd function
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a, a)

## nCr function efficient using Binomial Cofficient
def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return int(res) 

## upper bound function code -- such that e in a[:i] e < x;
def upper_bound(a, x, lo=0):
    hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo

## prime factorization
def primefs(n):
    ## if n == 1    ## calculating primes
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    ## prime factoriazation of n is stored in dictionary
    ## primes and can be accesed. O(sqrt n)
    return primes

## MODULAR EXPONENTIATION FUNCTION
def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 

## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b

# find function with path compression included (recursive)
# def find(x, link):
#     if link[x] == x:
#         return x
#     link[x] = find(link[x], link);
#     return link[x];

# find function with path compression (ITERATIVE)
def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;


# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x

## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime

#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e6 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    ## function for storing smallest prime factors (spf) in the array

################## un-comment below 2 lines when using factorization #################
# spf = [0 for i in range(MAXN)]
# spf_sieve() 
def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    ## this function is useful for multiple queries only, o/w use
    ## primefs function above. complexity O(log n)

## taking integer array input
def int_array():
    return list(map(int, input().strip().split()))
## taking string array input
def str_array():
    return input().strip().split();

#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');

################### ---------------- TEMPLATE ENDS HERE ---------------- ###################

n = int(input());
ans = '';
while(n > 0):
    n -= 1;
    remainder = n % 26;
    digit = chr(remainder + 97);
    ans = digit + ans;
    n = (n - remainder) // 26;
print(ans);

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

ret = []

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():
    N = I()

    l = 0
    c = 1
    cur = N
    last = cur
    while True:
        cur -= 26 ** c
        c += 1
        if cur < 0:
            break
        last = cur

    if last == 0:
        l = c - 2
        # print('last=0', l, last)
        d = Base_10_to_n(last, 25).split(',')
        # print(d)

        print(l * 'z')
    else:
        l = c - 1
        ans = []

        last -= 1

        if last == 0:
            print(l * 'a')
            return

        while last > 0:
            # print('last', last)
            r = last % 26
            last //= 26
            # print('last', last)
            # print('r', l_alp[r])
            ans.append(l_alp[r])

        while len(ans) < l:
            ans.append('a')
        ans = ans[::-1]
        temp = ''
        for a in ans:
            temp += a
        print(temp)
    # print(d)

    # for i in range(1, 27):
    #     N = i
    #     while N > 0:
    #         r = N % 26
    #         N = N // 26

            # print('N', N, 'r', r, l_alp[r])

    # for N in range(1, 27):
    #     d = Base_10_to_n(N, 26).split(',')
    #     ans = ''

    #     print(N, d)

    #     for i in d:
    #         ans += l_alp[int(i)]

    #     print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

total = []
for i in range(1, 12):
    total.append(int(26 * (26 ** i - 1) / 25))

digits = 1
for i in range(11):
    if N > total[i]:
        digits += 1
    else:
        break

# digits が番号の長さ

if digits > 1:
    N -= total[digits-2]

N -= 1
# digits桁の26進数でNを表せば良い。
ans = [0] * digits


rem = N
for i in range(digits, 1, -1):
    if rem > 26 ** (i-1):
        ans[digits-i] = rem // 26 ** (i-1)
        rem = rem % (26 ** (i-1))

ans[digits-1] = rem
name = []

for digits in ans:
    name.append(alphabet[digits])

for s in name:
    print(s, end="")

Submission status: Accepted

Solution code:
n = int(input())
x = "abcdefghijklmnopqrstuvwxyz"
s = ""
while True:
  if n%26 == 0:
    s = "z"+s
    n -= 26
    n =n//26
  else:
    s = x[n%26-1]+s
    n = n//26
  if n==0:
    break
print(s)

Submission status: Accepted

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

while N > 26:
	N, mod = divmod(N-1, 26)
	ans = chr(ord('a')+mod) + ans

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

print(ans)

Submission status: Accepted

Solution code:
num=int(input())
rem=[]
while(num):
    if num%26>0:
        rem.append(num%26)
    else:
        rem.append(26)
        num-=1
        
    num=num//26
    if num >=1 and num <=26:
        print(chr(96+num),end="")
        break
  
for i in range(len(rem)-1,-1,-1):
  print(chr(96+rem[i]),end="")

Submission status: Accepted

Solution code:
N=int(input())
tmp_max=0

alpha_list=[]
for i in range(97,97+26):
    alpha_list.append(chr(i))    

for i in range(11):
    tmp_max=tmp_max+26**(i+1)
    if N <= tmp_max:
        keta=i+1
        mx=tmp_max
        mn=tmp_max-26**(i+1)+1
        break

ans=['a']*keta

ans[keta-1]=alpha_list[(N-mn)%26]

tmp=(N-mn)
for _ in range(keta-1):
    tmp=tmp//26
ans[0]=alpha_list[tmp]

tmp_keta=keta-2
count=1
while tmp_keta>0:
    tmp=(N-mn)
    for _ in range(count):
        tmp=tmp//26
    tmp=tmp%26
    ans[tmp_keta]=alpha_list[tmp]
    count=count+1
    tmp_keta=tmp_keta-1

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

Submission status: Accepted

Solution code:
import collections
n = int(input())
deq = collections.deque()
ls = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a"]
if n == 1:
    print("a")
else:
    n -= 1
    while n > 0:
        deq.appendleft(n%26)
        n //= 26
    ans = ""
    #print(deq)
    for i in range(len(deq)-2,0,-1):
        if deq[i] <= 0:
            deq[i-1] -= 1
            deq[i] += 26
    #print(deq)
    for i in range(len(deq)):
        if i != len(deq)-1:
            if deq[i] != 0:
                ans += ls[deq[i]-1]
        else:
            ans += ls[deq[i]]
    print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

import string
from collections import deque

name_table = 'z' + string.ascii_lowercase
ans = deque()


while n > 0:
    q = n // 26
    m = n % 26
    ans.appendleft(name_table[m])
    if m == 0:
        n = q - 1
    else:
        n = q

print(''.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
z=""
while n>0:
  n=n-1 ##for tracking last character
  z+= chr( n%26 + ord('a') )
  n=n//26
print(z[::-1])

Submission status: Accepted

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

ans=''
last=0

keta=1

while True:
    if last+26**keta>n:
        for i in range(keta):
            idx=n%26
            n//=26
            ans+=chr(97+idx)
        break
    n-=26**keta
    keta+=1
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
i = 1
ssum = 0
while n > ssum + 26**i:
    ssum += 26**i
    i += 1
alp = ['z'] + [chr(i) for i in range(97,97+26)]
ans = ''
import math
for j in range(1,i):
    n -= 26**j
for j in range(1,i+1):
    
    
    ans +=alp[n%26]
    ss = alp[n%26]
    
    n += 26-n%26
    n //= 26
    if ss == 'z':
        n -= 1

print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
from string import ascii_lowercase
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


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


def getDigit(N):
    x = 26
    i = 1
    while N > x:
        i += 1
        x += 26**i

    return i


def main():
    N = int(input())
    S = ascii_lowercase
    if N < 27:
        print(S[N - 1])
        return
    xdigit = getDigit(N)
    # print(xdigit)
    tN = N
    for i in range(1, xdigit):
        tN -= 26**i
    # print(tN)
    tN -= 1
    ans = ''

    for _ in range(xdigit):
        ans = S[tN % 26] + ans
        tN //= 26

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

i=0
while N>0:
    a=(N//(26**i))%26
    if a>0:
       list.append(chr(a+96))
       N=N-a*(26**i)
    else:
       list.append("z")
       N=N-26*(26**i)
    i+=1

list2=list[::-1]
ret=''.join(list2)
print(ret)

Submission status: Accepted

Solution code:
n = int(input())

a = "abcdefghijklmnopqrstuvwxyz"
s = ""

while n > 0:
    if n%26 == 0:
        s = a[n%26-1] + s
        n //= 26
        n -= 1
    else:
        s = a[n%26-1] + s
        n //= 26
    
print(s)

Submission status: Accepted

Solution code:
n=int(input())
for i in range(0,11):
    if n>(26**(i+1)-26)//25:
        idx=i
        k=n-(26**(i+1)-26)//25
ans=[]
#print(k)
while idx>=0:
    for i in range(26):
        if k>i*26**idx:
            s=i
    #print(s)
    ans.append(chr(s+97))
    k-=s*26**idx
    idx-=1
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

alp =  ["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"]
name = ""
for i in range (30):
    name = alp[n%26]+name
    if n <=26:
        break
    if n%26 == 0:
        n = int(n/26 -1)
    else:
        n //=26
   

print(name)

Submission status: Accepted

Solution code:
import math

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

def hantei(t):
    global print_list
    try:
        int(t)
    except ValueError:
        return
    else:
        n = int(t)
    
    if 1 <= n and n <= 1000000000000001:
        while(n >= 1):
            s = n % 26
            if s == 0:
                s = 26
            print_list.insert(0, moji_list[s])
            n = math.floor(n / 26)
            if s == 26:
                n -= 1
    else:
        return

hantei(t)
pu = ''.join(print_list)
print(pu)

Submission status: Accepted

Solution code:
n = int(input())

b = n%26
if b == 0:
    ans = "z"
    b = 26
else:    
    ans = chr(b+96)
i = 2
while 1:
    c = chr(((n-b)%26**i)//26**(i-1)+96)
    if ((n-b)%26**i)//26**(i-1) == 0:
        if n == b:
            break
        else:
            ans += "z"
            b += 26**i
    elif c != "`":
        ans += c
        b += (n-b)%26**i
    i += 1
print(ans[::-1])

Submission status: Accepted

Solution code:
N=int(input())

shisu26=[]

def shinhou26(M):
    #26進法の一番下の数を出力して、更新する関数
    #これに26進法の答えをいれていく
    amari=M%26
    shisu26.append(amari)
    if M>26:
        if M%26==0:
            M=(M-26)//26
            return M
        else:
            M=(M-M%26)//26
            return M
    elif M==26:
        M=0
        return M
    else:
        M=0
        return M
    #0をストップシグナルとする

for i in range(15):
    #十分な回す回数
    N=shinhou26(N)
    if N==0:
        break

shisu26=list(reversed(shisu26))
alp="zabcdefghijklmnopqrstuvwxy"

ans=""
for i in shisu26:
    s=alp[i]
    ans+=str(s)
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())

a = 0
b = 0
tm = 0
while a < n:
    tm += 1
    b = a
    a += 26 ** tm

def base_10_to_n(x, n, tm):
    A = deque([])
    while x > 0:
        A.appendleft(x%n)
        x = int(x/n)
    if len(A) < tm:
        for i in range(tm - len(A)):
            A.appendleft(0)
    else:
        pass
    return A
    
#print(n-b-1)
L = base_10_to_n(n - b - 1, 26, tm)

#print(a)
#print(L)
ans = ''
for i in L:
    ans += chr(i + 97)
print(ans)

Submission status: Accepted

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

ans = n - 1
name = ''
while ans >= 0:
  name += alpha[ans % 26]
  ans //= 26
  ans -= 1

print(name[::-1])

Submission status: Accepted

Solution code:
n = int(input())
name = []
eng = 'abcdefghijklmnopqrstuvwxyz'
while n:
  name.append(eng[n % 26-1])
  if n % 26 == 0:
    n = n // 26 - 1
  else:
    n //= 26
print(''.join(reversed(name)))

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)

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

Submission status: Accepted

Solution code:
n = int(input())
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']
b = ''
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = a[X_dumy%n-1]+out
        if a[X_dumy%n-1] == 'z':
          X_dumy -= 26
        X_dumy = X_dumy//n
    return out
 
z = Base_10_to_n(n, 26)
print(z)

Submission status: Accepted

Solution code:
case = "".join([chr(i) for i in range(97, 123)])
def case_26(n):
    ans = ""
    while n >= 26:
        ans += case[n%26]
        n = n//26 - 1
    ans += case[n]
    return ans
n = int(input())
print(case_26(n-1)[::-1])

Submission status: Accepted

Solution code:
#C
N = int(input())
alphabet = [chr(ord('a') + i) for i in range(26)]
i = 1
tmp = 0
tmppre = 0
while tmp < N:
    if i == 1:
        tmppre = 0
    else:
        tmppre =tmp 
    tmp += 26**i
    i += 1

i -= 1    
tmp = N - tmppre - 1
ans = []
for j in range(i):
    ans.append(tmp//(26 ** (i-j-1)))
    tmp -= (tmp//(26 ** (i-j-1))) * 26 ** (i-j-1)

ans_alpha = ''
for k in range(len(ans)):
    ans_alpha += alphabet[ans[k]]
    
print(ans_alpha)

Submission status: Accepted

Solution code:
def abc(num):
    c=None
    if(num<=26):
        c = chr(96+num)
    elif(num%26==0):
        c = abc((num//26)-1)+chr(122)
    else:
        c = abc(num//26)+chr(96+(num%26))
    return(c)

input_num = int(input())
print(abc(input_num))

Submission status: Accepted

Solution code:
n = int(input())
m = 1
k = n
s = ''
while True:
    k -= 26**m
    if k > 0:
        m +=1
    else:
        break
n -= 26*(26**(m-1)-1)//25
for i in range(m):
    j = ((n-1)//26**i + 1)
    if j%26 != 0:
        s += chr(j%26+96)
    else:
        s += 'z'
print(s[::-1])

Submission status: Accepted

Solution code:
N = int(input())

s = []
n = N
while True:
    mod = n % 26
    s.append(mod)
    if n // 26 == 0:
        break
    n = (n - mod) // 26

for i in range(len(s)):
    if s[i] == 0 and i != len(s)-1:
        s[i] = 26
        s[i+1] = s[i+1] - 1
    if s[i] == -1:
        s[i] = 25
        s[i+1] = s[i+1] - 1

if s[-1] == 0:
    s = s[:-1]

name = ''
for i in range(len(s)):
    name = 'abcdefghijklmnopqrstuvwxyz'[s[i]-1] + name

print(name)

Submission status: Accepted

Solution code:
n = int(input())
ans = list()
while n>0:
    x = n % 26
    if x == 0:
        x = 26
        n=n-1
    ans.append(x)
    n = int(n / 26)


str_ans = ""
for x in ans[::-1]:
    str_ans += chr(x+96)

print(str_ans)

Submission status: Accepted

Solution code:
n=int(input())
t = n
l=[]

while t>0:
 if t%26==0:
  p=26
  l.insert(0,chr(p +96))
 else:
  p=t%26
  l.insert(0,chr(p +96))
 t = (t-p)//26
 
print('' .join(l))

Submission status: Accepted

Solution code:
N = int(input())

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

ans = num2alpha(N)

print(ans.lower())

Submission status: Accepted

Solution code:
char = 'abcdefghijklmnopqrstuvwxyz'


N=int(input())
stack = 26
bstack = 0
length = 1
while True:
    if stack >=N:
        order = N-bstack-1#何番目de
        #print(order)
        counter = 0
        ans = ""
        for i in reversed(range(length)):
            if i == 0:
                ans = ans + char[order]
            elif order > 26**(i):
                div = int(order/26**(i))#3
                ans = ans + char[div]
                order = order - div*26**(i)
            else:
                ans = ans+ "a"
        print(ans)
        break    


    bstack = stack
    length += 1
    stack = stack+26**length#702

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import math


def main():
    n = int(input())
    if n == 1:
        print('a')
        return
    digits = deque()
    alpha = ord('a') - 1
    maxex = int(math.log(n-1, 26))
    ex = 1
    for ex in range(1, maxex + 2):
        bb = pow(26, ex - 1)
        aa = bb * 26
        rem = n % aa // bb
        n -= bb * rem
        if rem == 0:
            if n == 0:
                break
            rem += 26
            n -= aa
        digits.appendleft(chr(alpha + rem))

    [print(d, end='') for d in digits]
    print()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

n = int(input())
keta = int(math.log(n)/math.log(26)) + 1
name = [0]*keta

for i in range(keta):
    name[i] = n % 26
    n = n // 26

alp = ['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 j in range(keta):
    if name[j] == 0 and j != keta-1:
        name[j] = 26
        name[j+1] -= 1
        ans = alp[name[j]-1] + ans
    elif name[j] == -1 and j != keta-1:
        name[j+1] -= 1
        name[j] += 26
        ans = alp[name[j]-1] + ans
    elif j == keta-1 and name[j] == 0:
        pass
    else:
        #name[j] != 0
        ans = alp[name[j]-1] + ans

#print(name)
print(ans)

Submission status: Accepted

Solution code:
alphabet = 'aabcdefghijklmnopqrstuvwxy'
N =int(input())
name = ''
while N > 0:
    n = N % 26
    N = N // 26
    if n == 0:
        name += 'z'
        N = N-1
    else:
        name += alphabet[n]
new_name = name[::-1]
print(new_name)

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

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

    maxdigit = 1
    pre = 0

    while N - pre > 26 ** maxdigit:
        pre += 26 ** maxdigit
        maxdigit += 1


    # print(maxdigit,pre)

    N -= pre

    res = ''

    for d in range(1,maxdigit+1):
        for i in range(26):
            if N <= 26 ** (maxdigit - d) * (i + 1):
                res += alf[i]
                N -= 26 ** (maxdigit - d) * i
                break

    print(res)



main()

Submission status: Accepted

Solution code:
s='abcdefghijklmnopqrstuvwxyz'
n=int(input())
res=[]
n=n-1
while n>=0:
    res.append(n%26)
    n=n//26
    n=n-1
    #print(n,res[-1])
ans=''
for j in range(len(res)-1,-1,-1):
    ans=ans+s[res[j]]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mylist = []

flag = True
while (flag):
    sho = N // 26
    amari = N % 26
    kurisagari = False
    if amari == 0 :
        mylist.append(26)
        kurisagari = True
    else:
        mylist.append(amari)

    if sho < 27:
        flag = False
        if kurisagari:
            mylist.append(sho - 1)
        else:
            mylist.append(sho)
    else:
        if kurisagari:
            N = sho - 1
        else:
            N = sho
# print(mylist)

num2alpha = lambda c: chr(c+96)

alphabet_list = [num2alpha(i) for i in mylist]
# alphabet_list = alphabet_list[::-1]

print(''.join(alphabet_list[::-1]).strip("`"))

Submission status: Accepted

Solution code:
N = int(input())

r=[]
r.append(N%26)
x=N//26

if N%26==0:
  x=x-1
while x > 0:
  t=x%26
  r.append(t)
  x=x//26
  if t==0:
    x=x-1
  
A=["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"]

X = A[r[0]]
for i in range(len(r)-1):
    X = X + A[r[i+1]]

print(X[::-1])

Submission status: Accepted

Solution code:
i = int(input())
mozi = ""
while i>26:
    q, mod = divmod(i, 26)
    if mod == 0:
        q = q-1 
        mod = 26
    mozi = mozi + chr(mod+96)
    i = q
if i == 0:
    i = 26
mozi = mozi + chr(i+96)
kotae = mozi[::-1]
print(kotae)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

alpha = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())

i = 0
idx = n
if n > 26:
    while n > 0:
        idx = n
        i += 1
        n = n - 26**i
        # print(i, n)

else:
    print(alpha[n-1])
    sys.exit()

# letter len : i, idx 

def getstr(i, idx):

    if i == 0:
        return ""
    elif i == 1:
        return alpha[idx-1]
    else:
        # number in the range
        t = 26**i

        # number  of bin
        b = int(26 * idx / t)

        bb = 0
        tmp = idx
        while tmp > 0:
            tmp -= int(t/26)
            bb += 1

        b = bb - 1
        idx -= b * int(t/26) 
        i -= 1
        
        return alpha[b] + getstr(i, idx)

print(getstr(i,idx))

Submission status: Accepted

Solution code:
import sys

from typing import List


def _10_to_26(number: int) -> List[str]:
    if number // 26:
        division = number // 26
        remain = number % 26

        if remain is 0:
            if division == 1:
                return ['z']

            return _10_to_26(number // 26 - 1) + ['z']

        _ = _10_to_26(number // 26)
        _.append(
            to_char(remain)
        )
        return _
    return [
        to_char(number % 26)
    ]


def to_char(num: int) -> str:
    return chr(ord('a') - 1 + num)


def main() -> None:
    N = int(input())
    print(''.join(_10_to_26(N)))


if __name__ == '__main__':
    sys.setrecursionlimit(100000)
    main()

Submission status: Accepted

Solution code:
K1 = 1
K2 = 27
K3 = 703
K4 = 18279
K5 = 475255
alpha = "abcdefghijklmnopqrstuvwxyz"

n = int(input())

a = ""

def func(n,k):
	global a
	a=alpha[n%26]+a
	if(k>1):
		func(n//26,k-1)

sum = 0
for i in range(1,15):
	sumb = sum
	sum += 26**i
	if(sum >= n):
		#print(n-sumb-1,i)
		func((n-sumb-1),i)
		break
print(a)

Submission status: Accepted

Solution code:
import bisect
# import heapq
# from collections import deque
# from collections import Counter
# from fractions import gcd # >=Python3.5 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # <Python3.5
# from math import sqrt

#input = sys.stdin.readline
#def main():

#---------------------------------------------------------

n = int(input())
 
tmp = 0
li1 = []
li2 = []
 
alp = [chr(i) for i in range(97, 97+26)]
 
for i in range(200):
    tmp += 26**i
    li1.append(tmp)
    if tmp > 10**16:
        break
 
keta = bisect.bisect_right(li1,n)
 
m = n-li1[keta-1]
 
for i in range(200):
    a = m//26
    b = m%26
    li2.append(chr(97+b))
    if a==0:
        break
    if a<26:
        li2.append(chr(97+a))
        break
    m -= b
    m = m//26
 
li2.reverse()
l = len(li2)
 
for i in range(keta):
    if l < keta:
        li2.insert(0,'a')
        l+=1
    else:
        break
 
print(*li2, sep='')

Submission status: Accepted

Solution code:
n = int(input())
a = [0] * 12
for i in range(11,0,-1):
    m = n // 26 ** i
    a[i] = m
    n -= m * (26 ** i)
a[0] = n
for i in range(11, - 1, - 1):
    if a[i] == 0:
        a.pop(i)
    else:
        break
b = "abcdefghijklmnopqrstuvwxyz"
c = []
for i in range(len(a)):
    if i == len(a) - 1 and a[i] == 0:
        break
    elif i != len(a) - 1 and a[i] == 0:
        a[i] = 26
        a[i + 1] -= 1
    elif i != len(a) - 1 and a[i] == - 1:
        a[i] = 25
        a[i + 1] -= 1
    c.append(b[a[i] - 1])
c.reverse()
print(*c, sep="")

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    log26 = []
    while n > 0:
        log26.append(n%26)
        n //= 26

    ans = []
    for i in range(len(log26)-1):
        if log26[i] > 0:
            ans.append(log26[i])
        else:
            ans.append(log26[i]+26)
            log26[i+1] -= 1
    if log26[-1]!=0:
        ans.append(log26[-1])
    ans1 = []
    for i in range(len(ans)):
        ans1.append(chr(ans[i]+96))
    print("".join(ans1[::-1]))

resolve()