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:
def main():
    #N,K=map(int,input().split())
    #p=list(map(int,input().split()))
    N=int(input())
    ans=""
    while N!=0:
        tmp=N%26
        N//=26
        if tmp==0:
            ans="z"+ans
            N-=1
        else:
            ans=chr(tmp-1+ord("a"))+ans
    print(ans)

main()

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
ans=[]
while True:
    x=n%26
    if x==0:
        ans.append('z')
        n=(n-26)//26
    else:
        ans.append(chr(x+96))
        n=(n-x)//26
    if n==0:
        break
l=len(ans)
for i in range(l-1,-1,-1):
    print(ans[i],end='')

Submission status: Accepted

Solution code:
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    n = _i()
    r = ""
    while True:
        n -= 1
        m = n % 26
        r = chr(97 + m) + r
        n -= m
        n //= 26
        if n == 0:
            break

    return r


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

Submission status: Accepted

Solution code:
n = int(input())


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


print(str(convert(n)).lower())

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
ans = []
while N > 0:
    N -= 1
    x = N % 26
    N = N // 26
    ans.append(alf[x])
ans.reverse()
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.lower(num2alpha(n)))

Submission status: Accepted

Solution code:
n=int(input())
letter="zabcdefghijklmnopqrstuvwxy"
nam=[]
p=n
while p>0:
  q=p%26
  p=p//26
  if q==0:
    p-=1
  nam.append(letter[q])
nam.reverse()
ans="".join(nam)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
alph = [chr(i) for i in range(97, 123)]
x = 26
for i in range(1, 50):
    if n > x:
        n -= x
        x *= 26
    else:
        n -= 1
        ans = [0] * i
        for j in range(i):
            ans[j] = alph[n % 26]
            n //= 26
        ans.reverse()
        print("".join(ans))
        exit()

Submission status: Accepted

Solution code:
from sys import stdin,stdout
input = stdin.readline
output = stdout.write
n = int(input())
ans = ''
while n>0:
    if n%26:ans+=chr(64+n%26)
    else:
        ans+='Z'
        n-=1
    n//=26
ans=ans[::-1]
print(ans.lower()+'\n')

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

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:
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

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

N = int(input())
#N, M = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]

def n2a(n):
    return chr(n - 1 + ord("a")) if n else "z"
    
answer = ""
while N:
    answer += n2a(N % 26)
    N -= 1
    N //= 26
print(answer[::-1])

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N=int(input())-1

c=26
a=1
while N>=c:

    N-=c
    c*=26
    a+=1
#print(a)


lst=[0 for i in range(a)]
b=0
while N:
    a=N%26
    lst[b]=a
    N//=26
    b+=1

lst.reverse()
S="".join([chr(i+ord("a")) for i in lst])
print(S)

Submission status: Accepted

Solution code:
from decimal import *

n=Decimal(input())
chars=['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=''
while n>0:
    r=n%26
    ans = chars[int(r)]+ans
    if r==0:
        n = n//26-1
    else:
        n=n//26

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = []
tmp_n = N
while True:
    s, r = divmod(tmp_n, 26)
    if r == 0:
        r = 26
        s -= 1
    ans.append(chr(r+96))
    tmp_n = s
    if s <= 0:
        break
print("".join(ans[::-1]))

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
n -= 1
while True:
    ans = chr(97 + n % 26) + ans
    n = n // 26
    if n == 0:
        break
    n -= 1
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()-1
    ans=""
    while 1:
        if n<=25:
            ans += chr(97 + n)
            break
        r=n%26
        ans+=chr(97+r)
        n//=26
        n-=1
    print(ans[::-1])

main()

Submission status: Accepted

Solution code:
import sys
import string

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


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


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    ans = []
    alpha = string.ascii_lowercase
    while N:
        ans.append(alpha[(N-1)%26])
        if N % 26 == 0:
            N = N // 26 - 1
        else:
            N = N // 26
    ans.reverse()
    answ = ""
    for a in ans:
        answ += a
    print(answ)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
ans=""
while N > 0:
    if N % 26 == 0:
        ans = "z" + ans
        N-=1
    else:
        ans = chr(N % 26 + 96) + ans
    N //= 26
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
from string import ascii_lowercase as S
ans=""
d={(i+1)%26:S[i] for i in range(26)}

while n:
    ans+=d[n%26]
    if n%26:
        n//=26
    else:n=n//26-1

print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
import math

ALPHABET = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
result = []

def alphabet_decimal(v):
    quotient = math.floor(v / len(ALPHABET))
    surplus = v % len(ALPHABET)
    quotient -= 1 if surplus == 0 else 0
    surplus = len(ALPHABET) if surplus == 0 else surplus
    result.append(surplus)
    if len(ALPHABET) < quotient:
        alphabet_decimal(quotient)
    elif len(ALPHABET) < v:
        result.append(quotient)
    return "".join([ALPHABET[i - 1] for i in reversed(result)])

n = int(input())
print(str.lower(alphabet_decimal(n)))

Submission status: Accepted

Solution code:
N = int(input())
s = ""
while True:
    a = N//26
    b = N%26
    if b == 0:
        b += 26
        a -= 1
    if a == 0:
        s += chr(b+96)
        break
    s += chr(b+96)
    N = a
rslt = s[::-1]
print(rslt)

Submission status: Accepted

Solution code:
N = int(input())
s = [100] * 15
k = 0
for i in range (15):
    if N == 0:
        break
    s[i] = N%26
    N = (N - 1)//26
    k += 1
for i in range(k):
    if s[i] == 0:
        s[i] = 122
    else:
        s[i] = s[i] + 96
for i in range(k):
    print(chr(s[k - 1 - i]),end = "")
print()

Submission status: Accepted

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

N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = num2alpha(n)

print(ans.lower())

Submission status: Accepted

Solution code:

def solve(N):
    if N== 0:
        return ""
    if N == 1:
        return 'a'
    N -= 1
    A = 'abcdefghijklmnopqrstuvwxyz'
    N, r = divmod(N, 26)
    return solve(N) + A[r]
N = int(input())
print(solve(N))

Submission status: Accepted

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

rlt = ""

while N > -1:
  rlt = chr(ord("a")+N%26) + rlt
  N = N//26 - 1
  
print(rlt)

Submission status: Accepted

Solution code:
N = int(input())

q, mod = divmod(N, 26)
if mod == 0:
    ans = "z"
    q -= 1
else:
    ans = chr(mod+96)

while q > 0:
    q, mod = divmod(q, 26)
    if mod == 0:
        ans = "z" + ans
        q -= 1
    else:
        ans = chr(mod+96) + ans
    
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
from sys import stdin,setrecursionlimit
import heapq,bisect,math,itertools,string,queue,datetime,copy
setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, stdin.readline().split()))

num2alpha = lambda c: chr(c+64)

N = int(input())

anls = []
while N >= 1:
    ch = N%26
    if ch ==0:
        ch = 26
    anls.append(num2alpha(ch).lower())
    N = int((N-ch)/26)
anls = anls[::-1]
print(''.join(anls))

Submission status: Accepted

Solution code:
N = int(input())-1
ans = []
while N>=0:
    x = N%26
    N //= 26
    N -= 1
    ans.append(chr(97+x))
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)

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

# 実装を行う関数
def resolve(test_def_name=""):
    # 数値取得サンプル
    #   1行1項目 n = int(input())
    #   1行2項目 x, y = map(int, input().split())
    #   1行N項目 x = [list(map(int, input().split()))]
    #   N行1項目 x = [int(input()) for i in range(n)]
    #   N行N項目 x = [list(map(int, input().split())) for i in range(n)]

    # 文字取得サンプル
    #   1行1項目 x = input()
    #   1行1項目(1文字ずつリストに入れる場合) x = list(input())

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


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """2"""
        output = """b"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """27"""
        output = """aa"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """123456789"""
        output = """jjddja"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()

Submission status: Accepted

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

x = 26
c = 0
while N >= x :
  N -= x
  x *= 26
  c += 1

ret = []
while c >= 0 :
  y = N % 26
  N //= 26
  c -= 1
  ret.append(chr(ord('a') + y)) 

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

Submission status: Accepted

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

N=int(input())

ans=num2alpha(N)
ans=ans.lower()

print(ans)

Submission status: Accepted

Solution code:
N = int(input())-1
C = "abcdefghijklmnopqrstuvwxyz"
k = len(C)
c = 1
while N >= k**c:
    N -= k**c
    c += 1
s = ""
while c > 0:
    s = s+C[N//(k**(c-1))]
    N = N % (k**(c-1))
    c -= 1
print(s)

Submission status: Accepted

Solution code:
n=int(input())
ans=""
ns=[25]
for i in range(25):
    ns.append(i)
while n!=0:
    ans=chr(ord('a')+ns[n%26])+ans
    n=(n-1)//26
print(ans)

Submission status: Accepted

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

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)

def main():
    num = num2alpha(n)
    print(num.lower())
    return
main()

Submission status: Accepted

Solution code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
# def find(x):
#     alph=["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"]
#     return alph[x]
# n=int(input())
# ans=[]
# while(n>0):
#     ans.append(n%26)
#     n=n//26
# a=""
# for i in ans:
#     a+=find(i)
# print(a)
def divmod_excel(n):
    a, b = divmod(n, 26)
    if b == 0:
        return a - 1, b + 26
    return a, b
import string
def to_excel(num):
    chars = []
    while num > 0:
        # print(chars)
        num, d = divmod_excel(num)
        chars.append(string.ascii_lowercase[d - 1])
    return ''.join(reversed(chars))
n=int(input())
print(to_excel(n))

Submission status: Accepted

Solution code:
from string import ascii_lowercase


def solve(N):
    """
    >>> solve(2)
    b
    >>> solve(27)
    aa
    >>> solve(703)
    aaa
    """
    q = N
    ret = ""
    while True:
        q, r = divmod(q - 1, 26)
        ret = ascii_lowercase[r] + ret
        if q == 0:
            print(ret)
            return


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


def _test():
    import doctest
    doctest.testmod()


if __name__ == "__main__":
    import sys
    argv = sys.argv
    if len(sys.argv) == 1:
        # no option
        main()
    elif sys.argv[1] == "-t":
        _test()
    else:
        input = open(sys.argv[1]).buffer.readline

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
d = deque()
while(n):
    if(n%26 == 0):
        d.append("z")
        n = n//26 - 1
    else:
        d.append(chr(96+n%26))
        n//=26

while d:
    print(d.pop(),end="")

Submission status: Accepted

Solution code:
n = int(input())
kouho = []
alphabet = []
for i in range(26):
    alphabet.append(chr(ord("a") + i))
ans = []
while n > 0:
    p = (n) % 26
    q = n // 26
    if p == 0:
        p += 26
        q -= 1
    ans.append(alphabet[p - 1])
    n = q

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

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)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arp = list(" abcdefghijklmnopqrstuvwxyz")
ans = []
N = int(input())
while N != 0:
    K = N % 26
    if K == 0:
        K = 26
    ans.append(arp[K])
    N -= K
    N = N // 26
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())

i = 1
ans = []

while n > 0:
    tmp = n % 26
    if tmp == 0:
        tmp = 26
    ans.append(chr(tmp+96))
    n = (n-tmp)//26

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
kijun = ord("a")
n -= 1 #zero indexed
ans = []
mod = 26
while True:
    ans.append(n%mod)
    if n < mod:
        break
    n //= mod
    n -= 1

res = ""
for i in ans:
    res += chr(kijun+i)

print(res[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    m = 26
    ans = ''
    n = N
    while n:
        ans += chr((n-1) % m + 97)
        n = (n-1) // 26
    print(ans[::-1])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
al=[chr(ord('a') + i) for i in range(25)]
al=['z']+al
ans=''
while n>0:
    ans=al[n%26]+ans
    if n%26==0:
        n=(n-1)//26
    else:
        n//=26
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

A = "\0abcdefghijklmnopqrstuvwxyz"

b = ""

while n != 0:
    c = n % 26
    if c == 0:
        c = 26
    b = A[c] + b
    n -= c
    n //= 26

print(b)

Submission status: Accepted

Solution code:
import string
abc = string.ascii_lowercase

N = int(input())

out = ''
while True:
    out += abc[(N-1)%26]
    N -= 1
    N /= 26
    N = int(N)
    if N<1:
        break
print(out[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
r=""
a = 1
b = 26
n -= a
while n>=0:
    c = chr(ord("a") + (n % b) // a)
    r = c + r
    a = b
    b *= 26
    n -= a
print(r)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = ""
while n:
    n -= 1
    tmp = n % 26
    n //= 26
    ans = chr(97 + tmp) + ans
print(ans)

Submission status: Accepted

Solution code:
num_to_alpha = "zabcdefghijklmnopqrstuvwxy"

n = int(input())

ans = []
while n:
    num = n % 26
    ans.append(num_to_alpha[num])
    if not num:
        n -= 1
    n //= 26

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

Submission status: Accepted

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

if __name__ == '__main__':
  def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
  n=int(input())
  print(num2alpha(n).lower())

Submission status: Accepted

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

s = "abcdefghijklmnopqrstuvwxyz"
n = int(input())
res = ""

while n:
    if n % 26 == 0:
        res += "z"
    else:
        res += s[(n - 1) % 26]
    n = (n - 1) // 26

print(res[::-1])

Submission status: Accepted

Solution code:
n=int(input())

l=[]
while n>0:
  r=(n-1)%26+1  
  l.insert(0,chr(ord('a')+r-1))
  n=(n-1)//26
  
print(''.join(l))

Submission status: Accepted

Solution code:
N = int(input())
name = ''
while N != 0:
    name = chr(ord('a') + (N-1) % 26)+name
    N = (N-1) // 26
print(name)

Submission status: Accepted

Solution code:
import string
k=list(string.ascii_lowercase)
n=int(input())
l=[]
while n>0:
  l.append(n%26)
  n=(n-1)//26
l.reverse()
x=""
for i in l:
  x+=k[i-1]
print(x)

Submission status: Accepted

Solution code:
n = int(input())
name = ''
while n != 0:
    name += chr(ord('a') + (n - 1) % 26)
    n = (n - 1) // 26
print(''.join(reversed(name)))

Submission status: Accepted

Solution code:
N=int(input())
n=0
for i in range(1,15):
   if N<=(n+26**i):
       break
   else:
       n+=26**i
#print(i)

N-=n
N-=1
#print(N)
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=""
for j in range(i):
    ans+=A[N//(26**(i-1-j))]
    N%=(26**(i-1-j))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string

n = int(input())

m = len(string.ascii_lowercase)
chars = string.ascii_lowercase[-1] + string.ascii_lowercase[:-1]
result = ''
while n:
    tmp = n%m
    result = chars[tmp] + result
    if n <= m:
        break
    n = (n-1)//m

print(result)

Submission status: Accepted

Solution code:
import sys
import math

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

def alphabet_decimal(v):
    quotient = math.floor(v / len(ALPHABET))
    surplus = v % len(ALPHABET)
    quotient -= 1 if surplus == 0 else 0
    surplus = len(ALPHABET) if surplus == 0 else surplus
    result.append(surplus)
    if len(ALPHABET) < quotient:
        alphabet_decimal(quotient)
    elif len(ALPHABET) < v:
        result.append(quotient)
    return "".join([ALPHABET[i - 1] for i in reversed(result)])

print(alphabet_decimal(int(input())))

Submission status: Accepted

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

while n>0:
    s=chr((n-1)%26+97)+s
    n=(n-1)//26
print(s)

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)
from math import log
n=int(input())
ans=num2alpha(n).lower()
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def solve(N):
    res = []
    while N > 0:
        N -= 1
        res.append(N%26)
        N //= 26
    return ''.join(chr(ord('a')+v) for v in reversed(res))

# for n in range(1,100):
print(solve(N))

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
for i in range(1,20):
    if 26**i>=n:
        break
    else:
        n -= 26**i
n -= 1
s = []
for j in range(i):
    s.append(n%26)
    n //= 26
s.reverse()
print(''.join([chr(ord('a')+x) for x in s]))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n, = map(int,read().split())
n -= 1

k = 26
l = 1
while n >= k:
    n -= k
    k *= 26
    l += 1

#print(n,k,l)

r = []
for i in range(l):
    r.append(n%26)
    n //= 26

s = "".join(map(lambda x: chr(x+ord("a")), r[::-1]))
print(s)

Submission status: Accepted

Solution code:
n = int(input())
x = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while True:
    ans = x[(n - 1) % 26] + ans
    n -= 1
    n //= 26
    if n == 0:
        break
    elif n < 26:
        ans = x[n - 1] + ans
        break
print(ans)

Submission status: Accepted

Solution code:
N = int(input()) - 1
k = 26
n = 1
while N >= k:
    N -= k
    k *= 26
    n += 1
ans = []
for i in range(n):
    ans.append(chr((N % 26) + ord('a')))
    N //= 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
res = ""
n = int(input())
dig = -1

for i in range(20):
    n -= 26 ** i
    if n < 26 ** (i + 1):
        dig = i + 1
        break

for i in range(dig):
    res += chr(ord('a') + n % 26)
    n //= 26

print(res[::-1])

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase

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")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

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 ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7


Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

n = int(ri())
# n-=1

arr = []
while n > 0:
    temp = n%26
    arr.append((temp-1)%26)

    if temp == 0:
        n= (n-1)//26
    else:
        n = n//26

ans = []
for i in range(len(arr)):
    ans.append(chr(ord('a') + arr[i]))

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

Submission status: Accepted

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

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