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:
import string
numbers = "0123456789"
alphabets = string.ascii_letters  # a-z+A-Zをロード
characters = numbers + alphabets


def base_cvt(value, n=2):
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp % n
        if idx == 0:
            idx = 26
            tmp = int(tmp / n) - 1
        else:
            tmp = int(tmp / n)
        result = characters[idx] + result
    if tmp != 0:
        idx = tmp % n
        result = characters[idx] + result
    return result


N = int(input())

res = base_cvt(N, 26)
if res[-1] == "0":
    res = "q" * (len(res)-1)
for d in str(res):
    if d == "0":
        d = "q"
    if ord(d) >= 96:
        d = str(9 + ord(d) - 96)
    print(chr(96 + int(d)), end="")
print()

Submission status: Accepted

Solution code:
import string
import math
n = int(input())

lis = list(string.ascii_lowercase)

ans =""
i = 1
while n > 0:
    if n <= 26:
        t = n % 26
        ans += lis[t-1]
        break
    else:
        if n % 26 == 0:
            ans += lis[25]
            n = (n // 26) -1
        else:
            t = n % 26
            ans += lis[t-1]
            n = n//26
    
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int ( input().strip() ) ;

c = 0 ;
r = 1 ;
while c < N :
	x = pow ( 26 , r ) 
	if x  + c >= N :
		break ;
	r += 1; 
	c += x ;

v = N - c -1 ;

L = [] ;
for x in range ( r ) :
	L.insert( 0 , chr( v % 26 + ord('a') ) ) ; 
	v //= 26 ;
print ( "".join(L) ) ;

Submission status: Accepted

Solution code:
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"]
S = ""
N = int(input())
while N > 26:
  if N % 26 != 0:
    a = N % 26
    N -= a
    S = L[a] + S
    N //= 26
  else:
    S = L[26] + S
    N //= 26
    N -= 1
S = L[N] + S
print(S.lower())

Submission status: Accepted

Solution code:
N = int(input())
if N == 26:
    print('z')
    exit()
elif N == 702:
    print('zz')
    exit()
elif N == 18278:
    print('zzz')
    exit()
elif N == 475254:
    print('zzzz')
    exit()
elif N == 12356630:
    print('zzzzz')
    exit()
elif N == 321272406:
    print('zzzzzz')
    exit()
elif N == 8353082582:
    print('zzzzzzz')
    exit()
elif N == 217180147158:
    print('zzzzzzzz')
    exit()
elif N == 5646683826134:
    print('zzzzzzzzz')
    exit()
elif N == 146813779479510:
    print('zzzzzzzzzz')
    exit()
L = [26**i for i in range(0,12)]
for i in range(1,11):
    L[i] += L[i-1]
a = 0
while N // L[a] >= 1:
    a += 1
A = []
for i in range(a):
    A.append(N % 26)
    if N % 26 == 0:
        N = (N//26)-1
    else:
        N = N // 26
d = {}
d[0] = 'z'
for i in range(1,27):
    d[i] = chr(96+i)
ans = ''
for i in range(-1,-len(A)-1,-1):
    ans += d[A[i]]
print(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)
n=int(input())
print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
n = int(input())
def colnum_string(n):
    string = ""
    while n > 0:
        n, remainder = divmod(n - 1, 26)
        string = chr(97 + remainder) + string
    return string

print(colnum_string(n))

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)

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

Submission status: Accepted

Solution code:
check_alf = [chr(ord('a') + i) for i in range(26)]

n=int(input())

check_num = 0

keta = 0

while check_num+26**(keta+1) < n:
    keta += 1
    check_num += 26**keta
sa = n - check_num

ans = []

index = keta

while keta > 0:
    if sa%(26**keta) == 0:
        ans.append(check_alf[sa//(26**keta)-1])
    else:
        ans.append(check_alf[sa//(26**keta)])
    sa -= (sa//(26**keta))*(26**keta)
    keta -= 1

ans.append(check_alf[sa-1])

print(''.join(map(str,ans)))

Submission status: Accepted

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

ans = []
while n >= 0:
    n, y = divmod(n, 26)
    ans.append(y)
    n -= 1
ans.reverse()


def to_alpha(x):
    return chr(x+ord('a'))


print(''.join(map(to_alpha, ans)))

Submission status: Accepted

Solution code:
N =int(input())
import math
def digits(n):
    digits = "abcdefghijklmnopqrstuvwxyz"
    return digits[n%26-1]

def alph(X):
    if int(X/27) >= 1:
        return alph(math.ceil(X/26)-1) + digits(X)
    else:
        return digits(X)
print(alph(N))

Submission status: Accepted

Solution code:
N = int(input())
s=1
while pow(26,s)<N:
    N-=pow(26,s)
    s+=1


N-=1
ans=["a"]*s
for i in range(s):
    r = N%26
    ans[i] = chr(ord(ans[i])+r)
    N//=26

#if ans[0]=="a":
#    ans[0]="z"
#else:
#    ans[0] = chr(ord(ans[0])+1)
print("".join(reversed(ans)))

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 = []
N = int(input())
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(N).lower())

Submission status: Accepted

Solution code:
N=int(input())
abclist=[]
for a in 'abcdefghijklmnopqrstuvwxyz':
    abclist.append(a)
k=0
n=N
alist=[]
while n>0:
    amari=n%26
    if amari==0:
        n=n//26-1
    else:
        n=n//26
    alist.append(amari)
#print(alist)
name=''

for a in alist:
    name=abclist[a-1]+name
print(name)

Submission status: Accepted

Solution code:
def main():
  num = int(input())
  
  dchar = 'abcdefghijklmnopqrstuvwxyz'
  result = []
  num = num - 1
  while num >= 0:
    result.append(dchar[num % 26])
    num = num // 26 - 1
  print(''.join(reversed(result)))
  
main()

Submission status: Accepted

Solution code:
n=int(input())
nt=n
i=1
temp=0
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"]
ans=[]
while True:
  if n<=temp+26**i:
    break
  else:
    temp=temp+26**i
    i=i+1
while True:
  if i==1:
    ans.append(al[(nt-temp-1)%26])
    break
  else:
    k=(nt-temp-1)//26**(i-1)
    ans.append(al[k])
    i=i-1
    nt=nt-26**i*(k+1)
    temp=temp-26**i
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())

cnt = [0] + [26 ** i for i in range(1, 11)]
for i in range(10):
    cnt[i + 1] += cnt[i]

ans = ""
x = N - 1
for i in reversed(range(1, 11)):
    if x >= cnt[i]:
        v = (x - cnt[i]) // 26 ** i
        ans += chr(ord("a") + v)
        x -= (v + 1) * (26 ** i)

ans += chr(ord("a") + x % 26)
print(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)

N = int(input())

print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
n = int(input())
al = list('abcdefghijklmnopqrstuvwxyz')

amari = []

while n != 0:
  if n%26 == 0:
    n = n//26 - 1
    amari.append(26)
  else:
    amari.append(n%26)
    n = n//26
  
amari.reverse()

ans = ''
for i in amari:
  ans += al[i-1]
  
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t=0
a=''
al='abcdefghijklmnopqrstuvwxyz'
b=[1]
c=[1]
for i in range(10):
  c.append(c[-1]*26)
  b.append(sum(c))
b.sort(reverse=True)
b.append(1)
c.sort(reverse=True)
c.append(1)
flg=0
i=0
while n>0:
  if flg ==1:
    if n >= b[i]:
      tmp=0
      while n >= b[i] and tmp <26:
        n -= c[i]
        tmp+=1
      a+=al[tmp-1]
      i+=1
    else:
      a+='a'
      i+=1
  elif n >= b[i]:
    flg=1
    tmp=0
    while n >= b[i] and tmp <26:
      n -= c[i]
      tmp+=1
    a+=al[tmp-1]
    i+=1
  else:
    i+=1
print(a)

Submission status: Accepted

Solution code:
N = int(input())
abc = ["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 = []
while N>0:
    result += [abc[((N-1) % 26)]]
    N = (N-1) // 26
print("".join(result[::-1]))

Submission status: Accepted

Solution code:
N = int(input())-1
letters = 'abcdefghijklmnopqrstuvwxyz'

result = ""
while N >= 0:
    i = N % 26
    result += letters[i]
    N = N // 26 - 1

print(result[::-1])

Submission status: Accepted

Solution code:
n=int(input())
i=1
a=0
m=n
while n-26**i>0:
    n=n-26**i
    i+=1
    a+=n**i #桁数
ans=""
b=0
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']
for j in range(i):
    b=m%26
    m=m//26
    if b==0:
      m=m-1
    ans=l[b-1]+ans
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
alphabet = 'abcdefghijklmnopqrstuvwxyz'
N = int(input())

n = N
name = []
while n != 0:
    name.append(alphabet[(n%26)-1])
    if n%26==0:
        n = int(n/26)-1
    else:
        n = int(n/26)


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

Submission status: Accepted

Solution code:
def main():
    alpha = 'zabcdefghijklmnopqrstuvwxy'
    N = int(input())
    name = ''
 
    while True:
        a = N%26
        name = alpha[a] + name
        N //=26
        if a == 0:
            N-=1
        if N == 0:
            break
    print(name)
 
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, collections, bisect, itertools, heapq, math, copy, string
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I() - 1

    ans = ''
    while N >= 26:
        ans += string.ascii_lowercase[N%26]
        N = N // 26 - 1
    ans += string.ascii_lowercase[N%26]

    print(ans[::-1])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n = int(input())

divisor = n
ans = ""
a = ["z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y"]
while divisor > 0:
    if divisor % 26 == 0:
        surplus = divisor % 26
        ans = a[surplus] + ans
        divisor = divisor // 26 -1
    else:
        surplus = divisor % 26
        ans = a[surplus] + ans
        divisor = divisor // 26
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
c=""
while(n>0):
    mod=n%26
    if mod==0:
        mod=26
    c+=chr(96+mod)
    n=(n-mod)//26
print(c[::-1])

Submission status: Accepted

Solution code:
N = int(input())

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

print(f(N))

Submission status: Accepted

Solution code:
N = int(input())
nanjo = -1
a = 1
while a <= N:
    a*=26
    nanjo += 1
A = [0]*(nanjo+1)
L = nanjo
for i in range(nanjo+1):
    A[i] = N//26**(nanjo)
    N -= A[i]*26**(nanjo)
    nanjo -= 1
for i in reversed(range(L+1)):
    if i != 0:
        if A[i] <= 0:
            A[i] += 26
            A[i-1] -= 1       
for i in range(L+1):
    if i == 0 and A[i] == 0:
        continue
    else:
        print(chr(A[i]+96), end = "")

Submission status: Accepted

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

    seed = 97
    answer = ""

    while True:
        remainder = N % 26

        if(remainder == 0):
            answer = "z" + answer
        else:
            answer = chr(seed - 1 + remainder) + answer

        if N <= 26:
            print(answer)
            return

        elif remainder == 0:
            N = N // 26 - 1

        else:
            N = N // 26

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:


import glob
import os

bn = os.path.basename(__file__).split('.')[0]
dn = os.path.dirname(__file__).split('/')

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = dn[len(dn)-2] + '\\' + dn[len(dn)-1] + '\\' + bn

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        N = int(self.input_data())
        dog_num = 1000000000000001
        alp = 'abcdefghijklmnopqrstuvwxyz'

        name = ''
        for i in range(0, 13, 1):
            n = N % 26
            if n != 0:
                name = alp[n-1] + name
            else:
                name = 'z' +name
            N = (N-1) // 26
            if N < 1:
                break
        print(name)

solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

Solution code:
N = int(input())
cnt = ['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']
ans2 = ''
for i in range(10**20):
  ans1 = cnt[N%26]
  ans2 = ans1 + ans2
  if N%26 == 0:
     N -= 1
  if N < 26:
    break
  N = N//26
print(ans2)

Submission status: Accepted

Solution code:
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
N = int(input())
ans = '' if N != 0 else 'a'
while N - 1 >= 0:
    N, r = divmod(N - 1, 26)
    ans += ALPHA[r]
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

ans = ''
while N > 0:
  N -= 1
  ans = chr(N%26+97) + ans
  N //= 26
print(ans)

Submission status: Accepted

Solution code:
import string

N = int(input())

alph = string.ascii_lowercase

def f(N):
    ans = []
    while N > 0:
        k = N % 26
        ans.append(alph[k-1])
        if N == 26:
            break
        if k == 0:
            N -= 26
        N = N // 26

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

print(f(N))

Submission status: Accepted

Solution code:
N = int(input())
strs = 26
ans = ''
while True:
  if N <= strs:
    ans += chr(N + 96)
    break
  if N % strs == 0:
    ans += 'z'
    N = N //strs - 1
  else:    
    ans += chr(N % strs + 96)
    N = N // strs
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
max = 0
length = 0
alphabet = 'abcdefghijklmnopqrstuvwxyz'
name = ""

i = 0
while True:
  i += 1
  max += 26**i
  length = i
  if N <= max:
    break

index_10 = N - (max - 26**i) -1

for j in range(length):
  index = index_10 % 26
  index_10 //= 26
  alphabet[index]
  name = alphabet[index] + name

print(name)

Submission status: Accepted

Solution code:
def main():
  N =  int(input())
  ans = ""
  moji = "abcdefghijklmnopqrstuvwxyz"
  while N > 0:
    N -= 1
    ans += moji[N%26]
    N //= 26
  print(ans[::-1])
  
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
N=int(input())

ans=[]
a=ord("a")
tmp=0
while N>0:
    tmp+=1
    if tmp==1:
        chrr=N%26-1
        if chrr<0:
            chrr+=26
        ans.append(chr(a+chrr))
    else:
        chrr=((N-1)//(26**(tmp-1)))%26
        if chrr<0:
            chrr+=26
        ans.append(chr(a+chrr))
    N-=26**tmp

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

Submission status: Accepted

Solution code:
N = int(input())

M = N

num_list = []

while M > 26:
    r = M % 26
    
    if r != 0:
        M = M // 26
    
    if r == 0:
        r = 26
        M = M // 26 - 1
    
    num_list.append(r)

if M != 0:    
    num_list.append(M)

num_list.reverse()

result = str()

for a in num_list:
    result = result + chr(a + 64).lower()

print(result)

Submission status: Accepted

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]

#cnt = 0
#cnt += 1
d=""
dchar ="abcdefghijklmnopqrstuvwxyz"

while N > 0:
    N -= 1
    d += dchar[N%26]
    N//=26
    #print(N%26,N,d)
    
print(d[::-1])


#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
#print(cnt)

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)).lower()
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = []
tmp = n
cnt = 1
r = 0
for i in range(1, 11):
  tmp -= pow(26, i)
  if tmp <= 0:
    break
  cnt += 1
  r += pow(26, i)
idx = n - r
now = 0
while(cnt!=1):
  cnt -= 1
  j = 1
  while(1):
    now += pow(26, cnt)
    if idx <= now:
      now -= pow(26, cnt)
      ans.append(j)
      break
    else:
      j += 1
k = 0
while(1):
  if now+k==idx-1:
    ans.append(k+1)
    break
  else:
    k += 1
anstr = ''
for e in ans:
  anstr += chr(e+96)
print(anstr)

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

Submission status: Accepted

Solution code:
# coding: utf-8
N=int(input())

num_a=ord("a")

ans=""
flg=True

X_dumy = N
while X_dumy>0:
    X_dumy-=1
    out = X_dumy%26
    X_dumy = X_dumy//26
    ans=chr(num_a+(out)%26)+ans


print(ans)

Submission status: Accepted

Solution code:
k = 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)

#１０進数を２６進数に変えれば良い。
# t = 0
# # print(len(a))
# for i in range(k):
#     k = k /26
#     t += 1
#     if k < 26:
#         amari = int(k % 26)
#         break
# print(k)
# print(t)
# print(amari)

print(num2alpha(k).lower())

Submission status: Accepted

Solution code:
n = int(input())

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






accm = 1

name = ""
for i in range(1, 20):

    start = accm
    end = pow(26, i)
    accm += end

    if n >= start and n <= accm - 1:

        hoge = n - start


        #print(i, n - start)

        remen = hoge

        for k in reversed(range(0, i)):
            temp = remen // pow(26, k)
            remen = remen % pow(26, k)
            #print(temp, remen)

            #print(temp, end=" ")
            #remen = remen % pow(26, k)
            name += alpha[temp]
            #print(alpha[temp], end=" ")


print(name)

Submission status: Accepted

Solution code:
num = int(input())

n = 26
nl = [26**i for i in range(1,12)]

for i in range(12):
    if num <= sum(nl[:i]):
        break
maxpower = i
num = num - sum(nl[:i-1])-1

lst = []
for i in range(maxpower-1, 0, -1):
    lst.append(num // (26**i))
    num = num % (26**i)
lst.append(num)

letters = 'abcdefghijklmnopqrstuvwxyz'

result = ''

for i in lst:
    result += letters[i]

print(result)

Submission status: Accepted

Solution code:
letters = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
n -= 1
bnds = [0]
i = 1
bnd = 1
while bnd <= 1000000000000001:
    bnd = int(26*(1-26**i)/(1-26))
    bnds.append(bnd)
    i += 1
for i in range(len(bnds)-1):
    if bnds[i] <= n < bnds[i+1]:
        j = i
n -= bnds[j]
ans = []
for i in range(j+1):
    x = n // (26**(j-i))
    #print(x)
    ans.append(letters[x])
    n -= x * (26**(j-i))
print(''.join(ans))

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline()[:-1]

N = int(input())

alphabet = "zabcdefghijklmnopqrstuvwxy"
#alpha = [chr(ord('a') + i) for i in range(26)]

name = ""

for i in range(10000):
    if N <= 26:
        q = N // 26
        mod = N % 26
        if mod == 0:
            q -= 1
        name = alphabet[mod] + name
        break
    else:
        q = N // 26
        mod = N % 26
        if mod == 0:
            q -= 1
        name = alphabet[mod] + name
        N = q


    #print(q, mod)


print(name)

Submission status: Accepted

Solution code:
N = int(input())

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

print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
def calc(num):
    if num % 26 != 0:
        res.append(num % 26)
    else:
        res.append(26)
        num -= 26

    if num // 26 > 0:
        calc(num // 26)

def printres():
    for obj in reversed(res):
        print(dic[obj], end="")
    print()

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

res = []


N = int(input())

calc(N)

printres()

Submission status: Accepted

Solution code:
s=int(input())
a=s
alp=list("abcdefghijklmnopqrstuvwxyz")
ans=""
i=1
#try:
while s!=0:
    jo=(26**i)
    x=s%jo
    if x==0:
      x=jo
    s-=x
    x//=26**(i-1)
    #print("{}%{} {} {}".format(s+x,jo,i,x))
    ans=alp[x-1]+ans
    i+=1
#except:
#  pass
  
print(ans)

Submission status: Accepted

Solution code:
N = int(input())


def Base_10_to_n(X, n):
    # X = 18278; n=26
    X_dumy = X
    out = ''
    while X_dumy > 0:
        a = X_dumy % n
        if a == 0:
            a = 26
            X_dumy -= 1
        out = string[a - 1] + out
        X_dumy = int(X_dumy / n)

    return out


string = 'abcdefghijklmnopqrstuvwxyz'
print(Base_10_to_n(N, 26))

Submission status: Accepted

Solution code:
x = 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(x)
print(a.lower())

Submission status: Accepted

Solution code:
N = int(input())


amari = []
while(N>0):
    if N%26 == 0:
        amari.append("z")
        N = N//26-1
    else:
        amari.append(chr(N%26+96))
        N = N//26
amari.reverse()
for i in range(len(amari)):
    print(amari[i],end = "")

Submission status: Accepted

Solution code:
N=int(input())
dic= ['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 -=1
ans = ''
while N >= 26:
    a = N%26
    N = N//26 -1
    ans = dic[a] + ans
    

ans = dic[N] + ans  
print(ans)

Submission status: Accepted

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

n = int(input())
i = 0
while 26 ** i < n:
    i += 1
    if 26**i > n:
        i -= 1
        break
start = ["a"]*i
#n -= 26**i
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
m = num2alpha(n)

ans = []
print(m.lower())

Submission status: Accepted

Solution code:

def tostr(N):
    if N == 0:
        return "a"
    if N == 1:
        return "b"
    if N == 2:
        return "c"
    if N == 3:
        return "d"
    if N == 4:
        return "e"
    if N == 5:
        return "f"
    if N == 6:
        return "g"
    if N == 7:
        return "h"
    if N == 8:
        return "i"
    if N == 9:
        return "j"
    if N == 10:
        return "k"
    if N == 11:
        return "l"
    if N == 12:
        return "m"
    if N == 13:
        return "n"
    if N == 14:
        return "o"
    if N == 15:
        return "p"
    if N == 16:
        return "q"
    if N == 17:
        return "r"
    if N == 18:
        return "s"
    if N == 19:
        return "t"
    if N == 20:
        return "u"
    if N == 21:
        return "v"
    if N == 22:
        return "w"
    if N == 23:
        return "x"
    if N == 24:
        return "y"
    if N == 25:
        return "z"
    if N == 0:
        return "z"


def main(N):
    N -= 1
    ans = ""
    loop = 0
    while True:
        if N < 0:
            break
        if N <= 25:
            ans = tostr(N)+ans
            break
        ans = tostr(N % 26)+ans
        N = N//26
        N -= 1
    return ans


N = int(input())
print(main(N))

Submission status: Accepted

Solution code:
n = int(input())
a = 26
keta = 1
nn = 0
while n > 0:
    if n > a:
        keta += 1
        n -= a
        a *= 26
    else:
        nn = n - 1
        n -= a
#nnを桁数をketaとして26進法で表す
l = []
for i in range(keta):
    amari = nn % 26
    nn = nn // 26
    l.append(amari)
revl = []
for i in range(len(l)-1,-1,-1):
    revl.append(l[i]+97)
ansl = []
for i in revl:
    ansl.append(chr(i))
print("".join(ansl))

Submission status: Accepted

Solution code:
n = int(input()) 

s=''

num2alpha = lambda c: chr(c+96)

q=n
while 1:
    q, mod = divmod(q, 26)

    if mod==0:
        s=s+'z'
        q-=1
    else:
        s=s+num2alpha(mod)
    if q<=26:
        if q!=0:
            s=s+num2alpha(q)
        break;

s = s[::-1]
print(s)

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

def I(): 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 main():
    n = I()-1
    name = [n%26]
    n = n // 26 -1
    while n >= 0:
        name.append(n%26)
        n  = n // 26 -1
    name.reverse()
    for na in name:
        print(chr(ord('z')-25+na), end='')
    print()

if __name__ == '__main__':
    main()

Submission status: Accepted

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

i=1
while True:
    if n <= 26**i:
        break

    else:
        n -= 26**i
        i += 1

ans = []

for j in range(i-1, -1, -1):
    s1 = n // (26**j)
    s2 = n % (26**j)
    if s2 == 0:
        s1 -= 1
    if j > 0:
        if s1 >= 26:
            s1 = 25
            ans.append(lis[-1])
        else:
            ans.append(lis[s1])
        n -= (26**j) * s1
    elif j == 0:
        ans.append(lis[n-1])

print(''.join(ans))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
import string

N = ii()
alpha = [chr(i) for i in range(97, 97+26)]
N_ = N
'''
alpha = [chr(i) for i in range(97, 97+26)]
if 0 <= N <= 25:
    print(alpha[i])
elif 26<= N <= 702:
'''
ans = ''
N -= 1
a = float('inf')
flag = False
'''
while True:
    N, a = N//26, N%26
    #print(N, a)
    #if flag == False:
    if ans == '' or ans[-1] != 'z' :
        ans += alpha[a-1]
    else:
        ans += alpha[a-2]
        flag = False
    if N == 0:
        break

'''
while True:
    N, a = N//26, N%26
    #print(N, a)
    #if not flag:
    #if not flag:
    ans += alpha[a]
    #else:
        #ans += alpha[a-1]
    flag = True
    N -= 1
    if N < 0:
        break
    #else:
        #ans += alpha[a-1]
        #flag = False
    #if a == 25:
        #flag = True


#l = [26]
#tmp = 26
#while True:
    #tmp *= 26
    #if tmp + l[-1] >= 1000000000000001:
        #break
    #l.append(tmp + l[-1])

#if N_ in l:
    #print(ans[1:][::-1])
#else:
print(ans[::-1])

Submission status: Accepted

Solution code:
def ans(an, n, N, X, x, inx):
  N -= inx * x ** (n + 1)
  if n == 0:
    an += X[N]
    return an
  
  an += X[N // x**n]
  inx = N // x**n
  n -= 1
  return ans(an, n, N, X, x, inx)
N = int(input())
X = "abcdefghijklmnopqrstuvwxyz"
an = ""
x = 26
n = 1
inx = 0
while N > x * ((x**n - 1)//(x - 1)):
  n += 1
n -= 1
N -= x * ((x**n - 1)//(x - 1)) + 1
print(ans(an, n, N, X, x, inx))

Submission status: Accepted

Solution code:
N = int(input())

ans = []
lst = []
n = N

while n > 26:
    x = n%26
    if x == 0:
        n = n//26 - 1
    else:
        n = n//26
    lst.append(x)


for i in range(len(lst)):
    x = lst[i]
    if x == 0:
        y = chr(97+25)
    else:
        y = chr(97 + x-1)
    ans.append(y)

ans.append(chr(97 + n-1))

ans = ans[::-1]

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

Submission status: Accepted

Solution code:
n=int(input())
const=list('abcdefghijklmnopqrstuvwxyz')
res = ''
tmp=n
while 1:
  y = tmp % 26
  res = const[y-1]+res
  tmp = tmp // 26 if y else tmp//26-1
  #print(y,tmp)
  if tmp==0:
    break
print(res)

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
N = int(input())

MOJI = [26]
for i in range(2,12):
  MOJI.append(MOJI[i-2]+26**i)

#print(MOJI)

C = bisect_left(MOJI, N)+1

ans = []
for i in range(0,C):
  tmp = N%26
  if tmp == 0:
    tmp = 26
  #print(tmp)
  ans.append(chr(tmp+ord("a")-1))
  N = (N-tmp)//26
  #print(N)

ans.reverse()

L=[str(a) for a in ans]
L="".join(L)
print(L)