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

l = 1
s = 0
while s <= n:
    s += pow(26, l)
    l += 1

l -= 1
s -= pow(26, l)

ans = ['a' for _ in range(l)]

dif = n - s
for i in range(l):
    tmp = pow(26, l - i - 1)
    ans[i] = chr(ord(ans[i]) + dif // tmp)
    dif %= tmp

print(''.join(ans))

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
ans=[]
while n:
    n-=1
    tmp=n%26
    ans.append(al[tmp])
    n//=26
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
string = ""
while N > 0:
    N, remainder = divmod(N - 1, 26)
    string = chr(97 + remainder) + string
print(string)

Submission status: Accepted

Solution code:
n = int(input())

table = {c: n for c, n in enumerate("abcdefghijklmnopqrstuvwxyz")}

ans = ""
while n > 0:
    n -= 1
    ans = table[n % 26] + ans
    n //= 26

print(ans)

Submission status: Accepted

Solution code:
ans = []
n = int(input())
while(n!=0):
    x = n % 26
    n //= 26
    if x == 0:
        x = 26
        n -= 1
    ans.append(chr(96+x))

ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62


def solve(N: int):
    base = 26
    # z 26
    # aa 27
    # ab 28
    if N == 1:
        print("a")
        return
    rans = []
    for i in range(100000):
        if N == 0:
            break
        N -= 1
        if i == 0:
            rans.append(chr(N % base + ord('a')))
            N = N // base
        else:
            rans.append(chr((N) % base + ord('a')))
            N = N // base
    print("".join(reversed(rans)))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
alpha = "abcdefghijklmnopqrstuvwxyz"
assert len(alpha) == 26


def solve(N):
    ans = []
    while N:
        N -= 1
        N, i = divmod(N, 26)
        ans.append(alpha[i])
    return "".join(ans[::-1])


(N,) = [int(x) for x in input().split()]
print(solve(N))

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

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())
#c=1
#ans_l=[]
#while(N==0):
#    tmp=N%(26**c)
#    ans_l.append(tmp//(26**(c-1)))
#    N-=tmp**(c-1)

#for i in ans_l:

Submission status: Accepted

Solution code:
x = int(input())
base = 26
len = 1

while x > base:
    x -= base
    base = base * 26
    len += 1

ret = ""
subbase = base // 26
x -= 1
while subbase:
    c = x // subbase
    # print(f"x = {x}, c = {c}")
    ret += chr(ord("a") + c)
    x -= subbase * c
    subbase //= 26
    
print(ret)

Submission status: Accepted

Solution code:
n = int(input())
nmax = 1000000000000001
alp = list("abcdefghijklmnopqrstuvwxyz")
ans = []
while n > 0:
    r = n%26
    if r == 0:
        r = 26
    n = (n-r)//26
    ans.append(alp[r-1])
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
N=int(input())
N-=1
Z=26
Y=1
while Z<=N:
  N-=Z
  Z*=26
  Y+=1
P=''
for i in range(Y):
  P+=chr(ord('a')+N%26)
  N=N//26
print(P[::-1])

Submission status: Accepted

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############
N = I()
ans = []
while N:
  ans.append(N%26)
  N = (N-1)//26
  
print(*[AZ[i-1] for i in ans[::-1]],sep="")

Submission status: Accepted

Solution code:
def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

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__":
    N = int(input())
    ans = num2alpha(N)
    print(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(num2alpha(N).lower())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = 'zabcdefghijklmnopqrstuvwxy'
    ans = ''
    i = 0
    while N > 0:
        ans += a[N%26]
        N =  (N-1)//26
        # print(N)
    print(ans[::-1])

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
(N, ) = [int(n) for n in input().split()]

l = 1
d = 26
N -= 1
while d <= N:
    N -= d
    d *= 26
    l += 1
    
ans = []
for _ in range(l):
    ans.append(N % 26)
    N //= 26

print(''.join(chr(ord('a')+a) for a in reversed(ans)))

Submission status: Accepted

Solution code:
n=int(input())
s=''
while n:
  n-=1
  s=chr(97+n%26)+s
  n//=26
print(s)

Submission status: Accepted

Solution code:
i = int(input())

res = ""
if i ==1:
  print("a")
else:
  while i > 0:
    i-=1
    temp = i%26
    res = chr(97+temp) + res
    i = i//26

  print(res)

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()
ans=ans.replace("'","")
print(ans)

Submission status: Accepted

Solution code:
ordA = ord('a')

N = int(input())

i = 1
acc = 0
while acc + 26**i < N:
    acc += 26**i
    i += 1
#print('i:', i)
#print('acc:', acc)

N -= acc + 1
#print('N:', N)

anss = ''
for _ in range(i):
    no = N % 26
    anss += chr(ordA + no)
    N //= 26

#print('#' + anss + '#')
print(anss[::-1])

Submission status: Accepted

Solution code:
alphabets = "abcdefghijklmnopqrstuvwxyz"

N = int(input())

c = 26
w = 1
n = N
while c < n:
	n -= c
	c *= 26
	w += 1

#print(c, w, n)

name = ""
n -= 1
for i in range(w):
	name = alphabets[n % 26] + name
	n //= 26

print(name)

Submission status: Accepted

Solution code:
import bisect
N = int(input())
D = [0]*12
SD = [0]*12
tmp = 26
for i in range(1, 12):
    D[i] = tmp
    SD[i] = SD[i-1] + D[i]
    if SD[i] > 1000000000000001:
        break
    tmp *= 26


L = bisect.bisect_left(SD, N)
alpha = 'abcdefghijklmnopqrstuvwxyz'
ans = []
N -= SD[L-1] + 1
for i in range(L):
    ans.append(alpha[N % 26])
    N //= 26


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

Submission status: Accepted

Solution code:
import sys
from string import ascii_lowercase as a2z

input = sys.stdin.readline


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

    i = 1
    min_v = 1
    max_v = 26
    while True:
        if N <= max_v:
            j = N - min_v
            ans = ""
            for _ in range(i):
                r = j % 26
                ans = "".join([a2z[r], ans])
                j = (j - r) // 26
            break
        min_v += 26 ** i
        i += 1
        max_v += 26 ** i

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
tmp = 0
for i in range(1, 100):
    if n<=tmp+26**i:
        digits = i
        n -= tmp+1
        break
    tmp += 26**i
ans = []
for i in range(digits):
    ans.append(chr(n%26+ord('a')))
    n //= 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def qw(n):
    a = "abcdefghijklmnopqrstuvwxyz"
    if n == -1:
        return("")
    return(qw(n // 26 - 1) + a[n % 26])
def solve():
    n = inp()
    a = "abcdefghijklmnopqrstuvwxyz"
    q = qw(n - 1)
    print(q)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * (max(a) + 1)
    for i in range(len(a)):
        q[a[i]] = q[a[i]] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Submission status: Accepted

Solution code:
N = int(input())

ans = []
while N >= 1:
    N -= 1
    ans.append(chr(97 + N % 26))
    N //= 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
import sys
from string import ascii_lowercase

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    
    ans = []
    while N:
        N, r = divmod(N, 26)
        if r == 0:
            r = 26
            N -= 1
        ans.append(ascii_lowercase[r-1])
    
    print(''.join(reversed(ans)))
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
s=''
while n:
    n-=1
    s=chr(97+n%26)+s
    n//=26

print(s)

Submission status: Accepted

Solution code:
import sys
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:
import string

alphabets = string.ascii_lowercase

N = int(input()) - 1

res = ""

while True:
    res += alphabets[N % 26]
    N //= 26
    N -= 1

    if N < 0:
        break

print(res[::-1])

Submission status: Accepted

Solution code:
n = int(input())

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

print(solve(n).lower())

Submission status: Accepted

Solution code:
N = int(input())
name = ""
while N > 0:
    name += chr(ord("a") + N%26 - 1) if N%26 != 0 else "z"
    N = (N-1)//26
print(name[::-1])

Submission status: Accepted

Solution code:
n = int(input())
t = 0
a = 0
while a < n:
    t += 1
    a += 26 ** t
n -= a // 26
ans = ''
for _ in range(t):
    ans += chr(n % 26 + 97)
    n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()

digit = 1

alphabets = "abcdefghijklmnopqrstuvwxyz"
ans = ""

while(1):
    if N > pow(26, digit):
        N -= pow(26, digit)
        digit += 1
        continue
    N -= 1
    for j in range(digit):
        ans += alphabets[N // pow(26, digit - j - 1)]
        N = N % pow(26, digit - j - 1)
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    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)
    i = I()
    print(num2alpha(i).lower())
    return


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input()) - 1
k = 1
while n >= 26 ** k:
    n -= 26 ** k
    k += 1
ans = []
for d in range(k):
    n, r = divmod(n, 26)
    ans.append(chr(97 + r))
print(''.join(reversed(ans)))

Submission status: Accepted

Solution code:
A = 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(int(A))
print(ans.lower())

Submission status: Accepted

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

print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
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

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 num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

def main():
    N = I()
    print(num2alpha(N).lower())


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s="abcdefghijklmnopqrstuvwxyz"
l=1
n=int(input())-1
while n>=26**l:
  n-=26**l
  l+=1
li=[]
while n:
  li=[n%26]+li
  n=n//26
r=""
for i in li:
  r+=s[i]
while len(r)!=l:
  r="a"+r
print(r)

Submission status: Accepted

Solution code:
N = int(input())
alphabet = [
    "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"]
out = []
div = 28


while True:
    N, mod = divmod(N, 26)
    if mod == 0:
        N -= 1
    out.append(alphabet[mod])
    if N == 0:
        break
print("".join(reversed(out)))

Submission status: Accepted

Solution code:
#N = int(input())
#A = list(map(int, input().split()))
#a, b = map(int, input().split())
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 string import ascii_lowercase
N = int(input())
ans = []
while N > 0:
    div, mod = divmod(N-1, 26)
    N = div
    ans.append(ascii_lowercase[mod])
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
def num2alpha(num: int):
    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:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
import string
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    n -= 1

    sol = []

    while n != -1:
        sol.append(string.ascii_lowercase[n % 26])
        n //= 26
        n -= 1

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


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

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

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

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

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


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


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


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

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

# endregion

if __name__ == "__main__":
    main()

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:
n = int(input())
n -= 1
ans = []
while True:
    # print(n)
    ans.append(chr(ord('a') + n % 26))
    n //= 26
    if n == 0:
        break
    else:
        n -= 1
ans = ans[::-1]
ans = ''.join(ans)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
res = []
abc = "abcdefghijklmnopqrstuvwxyz"
alpha = 26

while N > 0:
    res.append(abc[N%alpha-1])
    N = (N-1)//alpha

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

Submission status: Accepted

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

N = int(input())
S = ''
list_chr = [chr(i) for i in range(ord('a'), ord('z')+1)]

while True:
  N -= 1
  S = list_chr[N%26] + S
  N = N//26
  if N==0:
    break

print(S)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    N-=1
    ans=""
    while N>=0:
        #print(N)
        N,d=divmod(N,26)
        N-=1
        ans=num2alp(d)+ans
    print(ans)


    

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N):
    ans = []
    while N > 26:
        k = N % 26
        N //= 26
        if k != 0:
            ans.append(chr(ord('a') + k - 1))
        else:
            ans.append('z')
            N -= 1

    ans.append(chr(ord('a') + N - 1))
    return "".join(ans[::-1])
#
# assert(solve(1) == "a")
# assert(solve(26) == "z")
# assert(solve(27) == "aa")
# assert(solve(701) == "zy")
# assert(solve(702) == "zz")
# assert(solve(475256) == "aaaab")
# assert(solve(475254) == "zzzz")
# assert(solve(475255) == "aaaaa")
# assert(solve(475253) == "zzzy")
# assert(solve(123456789) == "jjddja")
# print("OK")

if __name__ == "__main__":
    S = int(input())
    print(solve(S))

Submission status: Accepted

Solution code:
n = int(input())
total = 0
for name_len in range(1,12+1):
    if total+26**name_len >= n:
        n -= total
        break
    else:
        total += 26**name_len
n -= 1
digits = []
for i in range(name_len):
    digits.append(chr(ord('a')+n%26))
    n //= 26
digits.reverse()
print(''.join(digits))

Submission status: Accepted

Solution code:
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline


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

N=int(input())

ans=num2alpha(N)


print(ans.lower())

Submission status: Accepted

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

def divmod2(n, d):
    a, b = divmod(n, d)
    if b == 0:
        return a-1, d
    return a,b

def base(n):
    ret = []
    while n > 0:
        n, d = divmod2(n, 26)
        ret += [chr(ord('a') + d - 1)]
    return ''.join(ret[::-1])

N = int(input())

print(base(N))