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


if  n >= ((26 ** 12 - 1) / (26 - 1)):
     n = n - ((26 ** 12 - 1) // (26 - 1))
     l = n // (26 ** 11)
     n = n % (26 ** 11)
     k = n // (26 ** 10)
     n = n % (26 ** 10)
     j = n // (26 ** 9)
     n = n % (26 ** 9)
     i = n // (26 ** 8)
     n = n % (26 ** 8)
     h = n // (26 ** 7)
     n = n % (26 ** 7)
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[l] + a[k] + a[j] + a[i] + a[h] + a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]      

elif n >= ((26 ** 11 - 1) / (26 - 1)):
     n = n - ((26 ** 11 - 1) // (26 - 1)) 
     k = n // (26 ** 10)
     n = n % (26 ** 10)
     j = n // (26 ** 9)
     n = n % (26 ** 9)
     i = n // (26 ** 8)
     n = n % (26 ** 8)
     h = n // (26 ** 7)
     n = n % (26 ** 7)
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[k] + a[j] + a[i] + a[h] + a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]      
     
elif n >= ((26 ** 10 - 1) / (26 - 1)):
     n = n - ((26 ** 10 - 1) // (26 - 1))
     j = n // (26 ** 9)
     n = n % (26 ** 9)
     i = n // (26 ** 8)
     n = n % (26 ** 8)
     h = n // (26 ** 7)
     n = n % (26 ** 7)
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[j] + a[i] + a[h] + a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]      
     
elif n >= ((26 ** 9 - 1) / (26 - 1)):
     n = n - ((26 ** 9- 1) // (26 - 1)) 
     i = n // (26 ** 8)
     n = n % (26 ** 8)
     h = n // (26 ** 7)
     n = n % (26 ** 7)
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[i] + a[h] + a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]      
     
elif n >= ((26 ** 8 - 1) / (26 - 1)):
     n = n - ((26 ** 8 - 1) // (26 - 1)) 
     h = n // (26 ** 7)
     n = n % (26 ** 7)
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[h] + a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]      
     
elif n >= ((26 ** 7 - 1) / (26 - 1)):
     n = n - ((26 ** 7 - 1) // (26 - 1))
     g = n // (26 ** 6)
     n = n % (26 ** 6)
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[g] + a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]

elif n >= ((26 ** 6 - 1) / (26 - 1)):
     n = n - ((26 ** 6 - 1) // (26 - 1))
     f = n // (26 ** 5)
     n = n % (26 ** 5)
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[f] + a[e] + a[d] + a[c] + a[b] + a[aa]
     
elif n >= ((26 ** 5 - 1) / (26 - 1)):
     n = n - ((26 ** 5 - 1) // (26 - 1))
     e = n // (26 ** 4)
     n = n % (26 ** 4)
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[e] + a[d] + a[c] + a[b] + a[aa]
     
elif n >= ((26 ** 4 - 1) / (26 - 1)):
     n = n - ((26 ** 4 - 1) // (26 - 1)) 
     d = n // (26 ** 3)
     n = n % (26 ** 3)
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[d] + a[c] + a[b] + a[aa]
     
elif n >= ((26 ** 3- 1) / (26 - 1)):
     n = n - ((26 ** 3 - 1) // (26 - 1)) 
     c = n // (26 ** 2)
     n = n % (26 ** 2)
     b = n // 26
     aa = n % 26
     ans = a[c] + a[b] + a[aa]
     
elif n >= ((26 ** 2 - 1) / (26 - 1)):
     n = n - ((26 ** 2 - 1) // (26 - 1)) 
     b = n // 26
     aa = n % 26
     ans = a[b] + a[aa]
     
else:
    ans = a[n-1]
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def h(n):
    if int(n/26):
        if n % 26 == 0:
            return h(int(n/26) - 1) + 'z'
        else:
            return h(int(n/26)) + chr(96 + (n % 26))
    else:
        if n > 0:
            return chr(96 + n)
        else:
            return ''

print(h(n))

Submission status: Accepted

Solution code:
N=int(input())
a_l=""
i=1
while i:
    if N<26:
        i=0
        l=chr(97+N-1)
    else:
        m = N % 26
        N=N//26
        if m==0:
            l="z"
            if N==1:
                l="z"
                i=0
            else:
                N=N-1
        else:
            l=chr(97+m-1)
    a_l=l+a_l
print(a_l)

Submission status: Accepted

Solution code:
N = int(input())

N -= 1
tmp = []
while N > -1:
    tmp.append(N % 26)
    N //= 26
    N -= 1
    if N == 0:
        tmp.append(0)
        break

res = ""
for t in tmp:
    res += chr(ord('a') + t)

print(res[::-1])

Submission status: Accepted

Solution code:
N = int(input())
l = []
while N:
    N -= 1
    l.append(chr(97+(N % 26)))
    N //= 26

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# C

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
# import numpy as np

input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

n = int(input()) - 1
n_ = n

cnt = 0
val = 0
while True:
    if n >= val:
        cnt += 1
        val += 26 ** cnt
        # print(val)
    else:
        break

keta = cnt
# print(keta)
cnt -= 1

if cnt > 0:
    for c in range(cnt):
        n_ -= 26**(c+1)
        # print(n_)
n = n_
# print(n)

ans = []
cnt = 0
while True:
    if (int(n / 26)):
        ans.append(chr(ord('a') + (n % 26)))
        n = n // 26
        cnt += 1
    else:
        ans.append(chr(ord('a') + (n % 26)))
        break

# print(ans)

diff = keta - len(ans)
# print('diff', diff)
ans = ans + ['a'] * diff

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

Submission status: Accepted

Solution code:
N = int(input())
s = ['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 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:
import sys

n = int(sys.stdin.read())
n -= 1
s = 'abcdefghijklmnopqrstuvwxyz'
write = sys.stdout.write
a = []
append = a.append
while n >= 26:
  n, v = divmod(n, 26)
  n -= 1
  append(s[v])
append(s[n])
a.reverse()
print(''.join(a))

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)


if __name__ == '__main__':
    N = intinput()

    # ord('a') 97
    ret = []
    while N > 0:
        n = N % 26
        n = n if n != 0 else 26
        # print(f"{N//26}, {n}")
        ret.append(n)
        N //= 26
        if n == 26:
            N -= 1
    ret.reverse()
    # print(ret)
    print(''.join(map(lambda e: chr(96+e), ret)))

Submission status: Accepted

Solution code:
num = int(input())

num2alpha = lambda c: chr(c+96)
ans = []
newans = []
string = ''

while num > 0:
    if num % 26 == 0:
        ans.append(26)
    else:
        ans.append(num%26)
    if num < 27:
        break
    num =  int((int(num) - 1) / 26)
    

for item in ans:
    newans.append(num2alpha(item))

for item in reversed(newans):
    string = string + item

print(string)

Submission status: Accepted

Solution code:
from sys import stdin

def Base_10_to_n(X, n):
    if X == 26:
        return "z"
    alpha = "zabcdefghijklmnopqrstuvwxy"
    X_dumy = X
    out = ''
    while X_dumy>0:
        amari = X_dumy%n
        if amari == 0:
            new = alpha[amari]
            out = new+out
            X_dumy = int(X_dumy/n)-1
        else:
            new = alpha[X_dumy%n]
            out = new+out
            X_dumy = int(X_dumy/n)
    return out

def main():
    n = int(input())
    x16_expr = Base_10_to_n(n, 26)
    print(x16_expr)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
result = ""

while N > 26:
    remainder = N % 26
    quotient = N // 26

    if (remainder == 0):
        remainder = 26
        quotient -= 1

    result += chr(remainder + 64)
    N = quotient

result += chr(N + 64)

print(result.lower()[::-1])

Submission status: Accepted

Solution code:
a=input()
b=int(a)

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)

name=num2alpha(b)
print(name.swapcase())

Submission status: Accepted

Solution code:
n = int(input());
a = 1;
list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

while True:
    b = 26*(26 ** a - 1) // 25;
    if b >= n:
        c = a;
        d = b-n;
        break;
    a += 1;

sol = [None]*c;
e = 26 **c -d-1;

for i in range(0,c):
    f = e % (26);
    sol[i] = list[f]
    e = ((e - f)//26);
    
con = ''

for v in range(c):
    con = con + sol[c-1-v];
    
print(con);

Submission status: Accepted

Solution code:
n = int(input())
word = ''
while n:
    a ,b = divmod(n, 26)
    if b == 0:
        word += (chr(96 + 26))
        n = a - 1
    else:
        word += (chr(96 + b))
        n = a
print(word[::-1])

Submission status: Accepted

Solution code:
N = int(input())
count = N
out = ''
dict = {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', 0: 'z'}

while count > 0:
    out = str(dict[count%26]) + out
    if count%26 == 0:
        count = count - 1
    count = int(count/26)

print(out)

Submission status: Accepted

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
# n=1000000000000001

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:
import sys, re
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
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A =[chr(i) for i in range(97, 97+26)]
# print(A)
L = []
while 1:
    a = N % 26
    N = N // 26
    # N -= 1
    if a == 0:
        N -= 1
    
    # print(a)
    # if a == 0:
    #     L.append(26)
    # else:
    L.append(a)
    if N <= 0:
        break
ans = ""
L.reverse()
for a in L:
    ans += A[a-1]
print(ans)





exit()
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+","+out
        X_dumy = X_dumy//n
    return out
# while N:
# while N:
#     a = N % 26
#     N = N // 26
#     print(a)
ans = Base_10_to_n(N, 26)
l = ans.split(",")
print(l)
ans = ""
r = l[:-2]
if Counter(r)["1"]==len(r) and l[-2] == "0":
    # print(r)
    print("z" * (len(r)))
    exit()
#  == len(l[:-1]) and l[-1] == "0":
    # print(l)
    # exit()
for a in l:
    if len(a) != 0:
        a = int(a)
        # if a == 0:
        #     ans += "z"
        # else:

        tmp = A[a-1]
        ans += tmp

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

nmax = 1000000000000001

def elc(idx):
    return( chr(ord('a') + idx ) )

lmt = [0]
lst = [1]
cur = 0
kw = 1
ans = []
while(1):
    if cur > nmax :
        break
    kw *= 26
    cur = cur + kw
    lmt.append(cur)
    lst.append(kw)

for i,el in enumerate(lmt):
    #print(i,el,lst[i])
    #continue
    if n > el:
        continue
    
    k = n - lmt[i-1] - 1
    #k = n - 1
    j = i - 1
    #print(k,lmt[i-1])
    while True:
        wkm = k % lst[j]
        wks = k // lst[j]
        #print('j:',j,'wks:',elc(wks))
        ans.append(elc(wks))
        if j == 0:
            #print(k,elc(wkm))
            #ans.append(elc(wkm))
            break
        else:
            k = wkm
        j -= 1
    break
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
als = ["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"]
ans = []
if n == 1:
  print("a")
  exit()
  
while n > 1:
  amari = n%26
  if amari==0 : n-=1
  alp = als[amari]
  n = n//26
  alp = als[amari]
  ans.append(alp)
  if (n == 1):
    alp = als[n%26]
    ans.append(alp)
print("".join(reversed(ans)))

Submission status: Accepted

Solution code:
from collections import deque
def add(x):
    return x+97

N = int(input())
i = 1
while N > 26**i:
    N = N - 26**i
    i += 1
    
N -= 1
shinsu = deque([])
for j in range(i):
    shinsu.appendleft(N%26)
    N //= 26

shinsu = list(map(add, shinsu))
ans = list(map(chr, shinsu))
print(''.join(ans))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'


def calc(x, i):
  target = x - 26 ** i
  if (target <= 0):
    return (x, i)
  else:
    return calc(target, i + 1)


target, index = calc(n, 1)
target -= 1
base26 = [0] * index
for i in range(index):
  tmp, target = divmod(target, 26 ** (index - i - 1))
  base26[i] = tmp
ans = ''
for i in base26:
  ans += s[i]
print(ans)

Submission status: Accepted

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

if N <= 26:
    r = N
    print(chr(ord("a")+r-1))
else:
    while N//26>0:
        r = N%26
        r -= 1
        d = N//26
        if r == -1:
            r = 25
            d -= 1
        N=d
        ans.append(chr(ord("a")+r))
    if N>0:
        r = N
        ans.append(chr(ord("a")+r-1))
    ans = ans[::-1]
    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)

print(str((num2alpha(N))).lower())

Submission status: Accepted

Solution code:
ALPHABET = "abcdefghijklmnopqrstuvwxyz"

def alphabet_decimal(v):
    def convert(v):
        while v > 0:
            yield ALPHABET[(v - 1) % len(ALPHABET)]
            v = (v - 1) // len(ALPHABET)
    return ''.join(convert(v))[::-1]
v =int(input())
print(alphabet_decimal(v))

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

import math
import itertools


n=int(input())
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=[]
while True:
    b=False
    if(n%26==0):
        b=True
    ans.append(alp[n%26-1])
    if(b):
        n-=1
    n//=26
    if(n==0):
        break
ans.reverse()
print(''.join(ans))

Submission status: Accepted

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

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

print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
def do():
    n=int(input())
    s="abcdefghijklmnopqrstuvwxyz"
    s1=""
    if n<=26:
        return s[n-1]
    else:
        while n>26:
            k=n%26
            n=n//26
            if k==0:
                s1+='z'
                n=n-1
            else:
                s1+=s[k-1]
        s1+=s[n-1]
        s1=s1[::-1]
        return s1
print(do())

Submission status: Accepted

Solution code:
def ninto26(n):
  num = list(range(1, 26)) + [0]
  alphabets = [chr(i + 97) for i in range(26)]
  
  dic = {n:a for n, a in zip(num, alphabets)}
  s = ""
  
  while n != 0:
    s += dic[n % 26]
    
    i = 0
    while 26 ** (i + 1) <= n:
      i += 1
    
    if n % 26 != 0:
      n -= (n % 26)
    else:
      n -= 26
      
    n //=  26
  return s

N = int(input())

print("".join(list(reversed(ninto26(N)))))

Submission status: Accepted

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

#print(26*26,26**3,26**4)

a=[]
a.append(0)
         
for i in range(12):
  t = 26**i + a[i]
  if N >= t:
    x = i+1 #文字数
  a.append(t)

#print("x",x)
#print("a[x]",a[x])

b=N-a[x] #差分
#print("b",b)
c=[]


for i in range(x):
  tmp=0
  d=0
  if len(c) == 0:
    d=b // 26**(x-i-1)
  else:
    for j in range(len(c)):
      tmp += 26**(x-j-1)*c[j]
    #print("i",i,"tmp",tmp)
    d=(b-tmp) // 26**(x-i-1)
  #print("d",d)
  c.append(d)

#print(c)

x=ord("a")
for i in range(len(c)):
  print(chr(x+c[i]), end="")

Submission status: Accepted

Solution code:
a = "zabcdefghijklmnopqrstuvwxy"
number = int(input())
result = ""
for i in range(13):
    result += a[int(number % 26)]
    if number % 26 == 0:
        number -= 26
    if number // 26  == 0:
        break
    number = number // 26
result = result[::-1]
print(result)

Submission status: Accepted

Solution code:
def wa(x):
    y=int(26*(26**x-1)/25)
    return y

n=int(input())
kake=0
count=0
ans=""
kotae=[]
al=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

while(n>kake):
        count+=1
        kake=wa(count)
#countが文字数
n-=wa(count-1)
n-=1
for x in range(count):
    kotae.append(al[n%26])
    n=n//26
for x in range(count):
    ans+=kotae[count-1-x]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
alp = [chr(ord('a') + i) for i in range(26)]
result = []
def Base10_to_alp(n):
    quot = int(n / 26)
    surplus = n % 26
    quot -= 1 if surplus == 0 else 0
    surplus = 26 if surplus == 0 else surplus
    result.append(surplus)
    if 26 < quot:
        Base10_to_alp(quot)
    elif 26 < n:
        result.append(quot)
    return "".join([alp[i - 1] for i in reversed(result)])
print(Base10_to_alp(N))

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
l = []
while n>0:
    w = chr(96+n%26)
    if not n%26:
        w = 'z'
        n-=26
    l.append(w)
    n = int(n//26)
l.reverse()
ans = ''.join(l)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
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 = []
a = 0
for num in range(1, 12):
  a += 26 ** num
  if n <= a:
    n -= (a - 26 ** num)
    break

for i in range(num, 0, -1):
  for j in range(26):
    if n <= 26 ** (i-1) * (j+1):
      n -= 26 ** (i-1) * j
      ans.append(alpha[j])
      break

print("".join(ans))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

ANS = []
c = 26
p = 97

while True:
    N -= 1
    n = N % 26
    ANS.append(chr(p + n))

    if N < 26:
        break

    N -= n
    N //= 26


print("".join(map(str, ANS[::-1])))

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
ans = ""
while n > 0:
    m = n%26
    nya = m-1 if m-1 >= 0 else 25
    ans += chr(ord('a') + nya)
    n -= nya
    n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    res = num2alpha(n)

    return res

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__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

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

def Base_10_to_n(x, n):
    tmp = x
    out = []
    while tmp>0:
        out.append(tmp % n)
        tmp = tmp // n 
    return out

keta = 1
tmp = 26
while tmp <= n:
    keta += 1
    tmp += 26**keta

n -= (tmp - 26**keta)

ans = []
for i in Base_10_to_n(n,26):
    ans.append(chr(ord('a')+i))
while keta!=len(ans):
    ans += ['a']
print("".join(reversed(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=[]
while n>26:
  x=n%26
  if x==0:
    ans.append("z")
    n=(n//26)-1
  else:  
    ans.append(l[x-1])
    n=n//26
ans.append(l[n-1])
ans.reverse()
Ans=""
for i in range(len(ans)):
  Ans=Ans+ans[i]
print(Ans)

Submission status: Accepted

Solution code:
n=int(input())
T='abcdefghijklmnopqrstuvwxyz'
s=''
while n>0:
    sn=n%26
    if sn>0:
        s=T[sn-1]+s
        n//=26
    else:
        s=T[25]+s

        n=n//26-1

print(s)

Submission status: Accepted

Solution code:
N = int(input())
S = N
B = ["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 = []
li = [0]
li2 = []
for i in range (14):
    li.append(26**(1+i))
a = 0
for j in range (14):
    a += li[j]
    li2.append(a)
k = 0
while(N > li2[k]):
    k+=1

S -= (li2[k-1] +1)
amari = S % 26
K = S
for l in range (k):
    A.append(B[(K//li[k - l])])

    K = K % li[k - l]
A.append(B[amari])
print(''.join(A[1:]))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    ans = []

    N -= 1
    while N >= 26:
        ans.append(N % 26)
        N = N // 26 - 1

    ans.append(N)

    ansstr = []
    for i, a in enumerate(ans[::-1]):
        ansstr.append(chr(ord("a") + a))
    print("".join(ansstr))

if __name__ == '__main__':
    main()