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 printString(n): 
    string = ["0"] * 10000
    i = 0
  
    while n > 0: 
        rem = n % 26
        if rem == 0: 
            string[i] = 'Z'
            i += 1
            n = int(n / 26) - 1
        else: 
            string[i] = chr((rem - 1) + ord('A')) 
            i += 1
            n = int(n / 26)
    string[i] = '0'
    string = string[::-1] 
    ans = "".join(string) 
    for i in range(10000):
        if ans[i]!="0":
            break
    print(ans[i:].lower())
    
n=int(input())
printString(n)

Submission status: Accepted

Solution code:
N = int(input())

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

name = ''
while N != 0:
    
    name += alphabet[(N-1) % 26]
    N = (N-1) // 26
print(name[::-1])

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:
## coding: UTF-8
N = int(input())

alphabet = 'abcdefghijklmnopqrstuvwxyz'

ans = []


#N = 123456789


while N > 0:
    if(N > 26):
        ans.append(N % 26)
        if(N % 26 == 0):
            N -= 26
        else:
            N -= N % 26
        N = N//26
        #print(ans, N)
    elif(N == 26):
        ans.append(0)
        N = 0
    else:
        ans.append(N)
        N -= N

#print(ans, N)
#print(ans[::-1])
ans = ans[::-1]


ret = []
for i in range(len(ans)):
    ret.append(alphabet[ans[i]-1])

print(''.join(ret))


'''
for i in range(12, 0, -1):
    #print(i)
    if(N // 26**i > 0)



if(N // 26**1 > 0):
    ans.append(alphabet[N//26**1 - 1])
    N -= 26**1 * (N//26**1)
ans.append(alphabet[N-1])
'''
#print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

moji_num = {1: 26}
for i in range(2, 100):
    moji_num[i] = moji_num[i-1] * 26
#print(moji_num)

ac = {0: 0, 1: 26}
for i in range(1, 100):
    if ac[i-1] >= n:
        break
    ac[i] = ac[i-1] + moji_num[i]
#print(ac)
mojisuu = i-1
nanmojime = n - ac[i-2] - 1
#print(mojisuu, nanmojime)

arr = []
for keta in range(mojisuu):
    sisuu = mojisuu - keta - 1
    #print(sisuu)
    arr.append(nanmojime // 26**sisuu)
    nanmojime %= 26 ** sisuu
#print(arr)

mojiretu = []
for num in arr:
    mojiretu.append(chr(97 + num))
#print(mojiretu)
print(*mojiretu, sep="")

Submission status: Accepted

Solution code:
import math
#map(int,input().split())
#int(x) for x in input().split()
#for _ in range(int(input())):
n=int(input())
s=''
while n>0:
	x=n//26
	d=n-x*26
	if d==0:
		s+='z'
		n=(n-26)//26
		continue
	else:
		s+=chr(96+int(d))
	if n%26==0 and x==1:
		break
	n=x
print(s[::-1])

Submission status: Accepted

Solution code:
n=int(input())
l=[chr(ord('a') + i) for i in range(26)]
ans=''
while n:
  a = n%26
  ans+=l[a-1]
  if n%26==0:
    n//=26
    n-=1
  else:
    n//=26
    ans = list(ans)
print(''.join(ans[::-1]))

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

i=1
tmp=0
while 1:
    tmp=tmp+26**i
    if tmp>=n:
        tmp-=26**i
        break
    i+=1
n-=tmp+1

#print(n)

ans=[]

for j in range(i):
    cnt=i-j-1
    #print(cnt)
    ans.append(n//(26**cnt))
    n=n-(n//(26**cnt))*(26**cnt)
#print(ans)
result=""
for item in ans:
    result+=(chr(97 + item))

print(result)

Submission status: Accepted

Solution code:

#s=list('abcdefghijklmnopqrstuvwxyz')
k=int(input())

from functools import lru_cache

@lru_cache(maxsize=1000)
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(k).lower())

Submission status: Accepted

Solution code:
import string

N = int(input())
d1, d2 = 0, 26
n = 1
while d2 < N:
    n += 1
    d1 = d2
    d2 += 26 ** n
m = N - d1 - 1
xs = [None] * n
for i in range(n):
    xs[-1 - i] = string.ascii_lowercase[m % 26]
    m //= 26
print(''.join(xs))

Submission status: Accepted

Solution code:
n=int(input())
ans=""
while n!=0:
    n-=1
    x=n%26
    if x==0:
        ans+="a"
    elif x==1:
        ans+="b"
    elif x==2:
        ans+="c"
    elif x==3:
        ans+="d"
    elif x==4:
        ans+="e"
    elif x==5:
        ans+="f"
    elif x==6:
        ans+="g"
    elif x==7:
        ans+="h"
    elif x==8:
        ans+="i"
    elif x==9:
        ans+="j"
    elif x==10:
        ans+="k"
    elif x==11:
        ans+="l"
    elif x==12:
        ans+="m"
    elif x==13:
        ans+="n"
    elif x==14:
        ans+="o"
    elif x==15:
        ans+="p"
    elif x==16:
        ans+="q"
    elif x==17:
        ans+="r"
    elif x == 18:
        ans += "s"
    elif x==19:
        ans+="t"
    elif x==20:
        ans+="u"
    elif x==21:
        ans+="v"
    elif x==22:
        ans+="w"
    elif x==23:
        ans+="x"
    elif x==24:
        ans+="y"
    elif x==25:
        ans+="z"
    n=(n-x)//26
ansr=ans[::-1]
print(ansr)

Submission status: Accepted

Solution code:
N = int(input())
ans = ""
al = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
while(True):
  if N <= 26:
    ans = al[N-1] + ans
    break
  tmp = N%26    
  ans = al[tmp-1] + ans
  N = N//26
  if tmp == 0:
    N -= 1
print(ans)

Submission status: Accepted

Solution code:
alphabet = {0:"a",1:"b",2:"c",3:"d",4:"e",5:"f",6:"g",7:"h",8:"i",9:"j",10:"k",11:"l",12:"m",13:"n",14:"o",15:"p",16:"q",17:"r",18:"s",19:"t",20:"u",21:"v",22:"w",23:"x",24:"y",25:"z"}
N = int(input())
name = ""
while N != 0:
     index= int(N%26)
     if index == 0:
         name += alphabet[25]
     else:
         name += alphabet[index-1]
     N = int((N-1)/26)
print(name[::-1])

Submission status: Accepted

Solution code:
# abc171_c.py
import math
N = int(input())
ans=[]
while N > 0:
    ans.append(N%26)
    N = math.floor((N-1)/26)
alphabet = 'abcdefghijklmnopqrstuvwxyz'
ans = reversed(ans)
for i in ans:
    print(alphabet[i-1],end="")

Submission status: Accepted

Solution code:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N = int(input())
    s = "abcdefghijklmnopqrstuvwxyz"
    ans = ""
    a = N-1
    x = 26
    i = 1
    while True:
        if a < x:
            break
        a -= x
        x *= 26
        i += 1

    while a:
        a, b = divmod(a, 26)
        ans = s[b] + ans


    print(s[0]*(i-len(ans)) + ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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:
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 string

def get_info(N):
    d = 1
    while N > pow(26, d):
        N -= pow(26, d)
        d += 1
    return d, N

def convert(x, n):
    if x // n == 0:
        return [x % n]
    return convert(x // n, n) + [x % n]

N = int(input().strip())
digit, n = get_info(N)
name = [string.ascii_lowercase[i] for i in convert(n-1, 26)]
if len(name) < digit:
    name = ["a" for _ in range(digit-len(name))] + name

print("".join(name))

Submission status: Accepted

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

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(str.lower(num2alpha(n)))

Submission status: Accepted

Solution code:
import math
from decimal import Decimal

N = int(input())

res = ""

alp = "0abcdefghijklmnopqrstuvwxyz"

while N > 0:
    # print(N)
    if N > 26:
        
        NN = N//26
        # print("NN: ", NN)
        # print(N - NN*26)
        m = N - NN*26
        N = N//26
        # print("m is ", m)
        if m==0:
            m=26
            N = N-1
        # print(alp[m], "!")
        res = alp[m] + res
    else:
        # print(alp[N])
        # print(alp[N], "!")
        res = alp[N] + res
        N = 0

print(res)

Submission status: Accepted

Solution code:
N = int(input())
l = 'abcdefghijklmnopqrstuvwxyz'
name = ''
while N > 0:
    t1 = N // 26
    t2 = N % 26
    if t2 == 0:
        t1 -= 1
    name = l[t2-1] + name
    N = t1
print(name)

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:
N = input()
N = int(N)
#print(N)
N-=1

dit = [0 for _ in range(100)]
i = 0
while True:
  dit[i] = N % 26
  N = N // 26
  if N == 0:
    break
  else:
    N -= 1
  i+=1

#print(dit)
name = ""
for j in range(i,-1,-1):
  name += chr(97+dit[j])
  
print(name)

Submission status: Accepted

Solution code:
n = int(input())
ord_a = ord("a")
ans = ""
now = 26
prev = 0
e = 1
num = 0
while True:
    if now >= n:
        num = n - prev -1
        break
    e += 1
    prev = now
    now += 26 ** e
ans = ""
for i in range(e):
    res,mod = divmod(num,26)
    ans = chr(mod+ord_a) + ans
    num = res
print(ans)

Submission status: Accepted

Solution code:
s = [input() for i in range(1)] 
num = int(s[0])

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

Submission status: Accepted

Solution code:
N = int(input())
name = ''
while N>0:
    N, r = divmod(N-1, 26)
    name = chr(65+r)+name
print(name.lower())

Submission status: Accepted

Solution code:
N = int(input())

ans = ''
while N:
    m = (N+25) % 26
    ans += chr(ord('a') + m)
    N = (N-m) // 26
print(ans[::-1])

Submission status: Accepted

Solution code:
tmp = "abcdefghijklmnopqrstuvwxyz"

current = int(input())
result = ""
while True:
    result += tmp[current % 26 - 1]
    current = (current - 1)// 26
    if current == 0:
        break

print(result[::-1])

Submission status: Accepted

Solution code:
n = int(input())

#26進数
dim = []
while n>0:
    q,r = divmod(n-1, 26)
    dim.append(r)
    n=q

import string
dic = {i:l for i,l in enumerate(string.ascii_lowercase)}

print(''.join([dic[d] for d in reversed(dim)]))

Submission status: Accepted

Solution code:
import sys
import math
def II():
	return int(sys.stdin.readline())

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

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
n = II()
ans = ""
while(n>0):
	ans+=chr(96+n%26) if n%26>0 else 'z'
	if n%26 == 0:
		n//=26
		n-=1
	else:
		n//=26
print(ans[:][::-1])

Submission status: Accepted

Solution code:
n = int(input())
n = n-1
alfabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ans = []
while n>=0:
    a = n%26
    n = n//26-1
    ans.append(alfabet[a])

ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())

ans = ""

digit_count = 1
check = 26

while N > check:
    digit_count += 1
    check += 26 ** digit_count

offset = check - 26 ** digit_count

N -= offset + 1

while digit_count > 0:
    ans = "" + chr(ord("a") + N % 26) + ans
    N //= 26
    digit_count -= 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from pprint import pprint
import sys

N = int(sys.stdin.readline().strip())

ans = ""
while N:
    pos = (N - 1) % 26
    char = chr(ord("a") + pos)    
    ans = char + ans
    # print(pos, char)
    N = (N - 1) // 26

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list('abcdefghijklmnopqrstuvwxyz')
s=[]#格納よう
i=1#桁数
while n>26**i:
  n-=26**i
  i+=1
n-=1
while i!=0:
  p=n//26**(i-1)
  n=n%26**(i-1)
  s.append(l[p])
  i-=1

print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input())

def callname(X):
    digits = 'abcdefghijklmnopqrstuvwxyz'
    if (int((X-1)/26)):
        return callname(int((X-1)/26))+digits[(X%26)-1]
    return digits[(X%26)-1]
print(callname(n))

Submission status: Accepted

Solution code:
N = int(input())

str = "abcdefghijklmnopqrstuvwxyz"
rewsna = ""
while N > 0:
    rewsna += str[N%26-1]
    x = N%26
    if x == 0:
        N = (N-1)//26
    else:
        N = (N-x)//26

ans = ""

for i in range(len(rewsna)):
    ans += rewsna[len(rewsna)-i-1]

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    abc = [chr(i) for i in range(97, 97+26)]
    N=ii()
    ans = ''
    while N:
        N-=1
        ans = abc[N%26] + ans
        N //= 26
    print(ans)




main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
alph = "abcdefghijklmnopqrstuvwxyz"
num = 0
now = 1
keta = 0
while True:
    now *= 26
    keta += 1
    if num + now >= n:
        break
    num += now
ban = n - num - 1 
ans = ""
for i in range(keta):
    ban, mod = divmod(ban, 26)
    ans = alph[mod] + ans
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
num2alpha = lambda c: chr(c+96)
li = []
while n>26:
    b = n%26
    n//=26
    if b==0:
        li.append("z")
        n-=1
    else:
        li.append(num2alpha(b))

if n<=26:
    li.append(num2alpha(n))

li.reverse()
print("".join(li))

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
for i in range(1, 100):
    if N <= pow(26, i):
        N -= 1
        for j in range(i):
            ans = chr(ord('a') + N % 26) + ans
            N //= 26
    else:
        N -= pow(26, i)
    if ans != '':
        break
print(ans)

Submission status: Accepted

Solution code:

N=int(input())
asci = 'abcdefghijklmnopqrstuvwxyz'
ans=[]
temp=N
while temp!=0:
    temp-=1
    ans.append(asci[temp%26])
    temp=temp//26
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
x = ""
a = []
def abc(p):
    if p == 1:
        return "a"
    elif p == 2:
        return "b"
    elif p == 3:
        return "c"
    elif p == 4:
        return "d"
    elif p == 5:
        return "e"
    elif p == 6:
        return "f"
    elif p == 7:
        return "g"
    elif p == 8:
        return "h"
    elif p == 9:
        return "i"
    elif p == 10:
        return "j"
    elif p == 11:
        return "k"
    elif p == 12:
        return "l"
    elif p == 13:
        return "m"
    elif p == 14:
        return "n"
    elif p == 15:
        return "o"
    elif p == 16:
        return "p"
    elif p == 17:
        return "q"
    elif p == 18:
        return "r"
    elif p == 19:
        return "s"
    elif p == 20:
        return "t"
    elif p == 21:
        return "u"
    elif p == 22:
        return "v"
    elif p == 23:
        return "w"
    elif p == 24:
        return "x"
    elif p == 25:
        return "y"
    elif p == 0:
        return "z"
while n > 0:
    a.append(abc(n%26))
    n = (n-1)//26
for i in range(len(a)):
    x += a[-i-1]
print(x)

Submission status: Accepted

Solution code:
n_of_l=[26 ,702 ,18278 ,475254 ,12356630 ,321272406 ,8353082582 ,217180147158 ,5646683826134 ,146813779479510 ,3817158266467286]
n=int(input())
ans=''
flag=1
le=0
while flag:
  if n<=n_of_l[le]:
    flag=0
  le+=1
li='abcdefghijklmnopqrstuvwxyz'
n-=n_of_l[le-2]+1
for i in range(le):
  ans+=li[n%26]
  n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    abcd = 'abcdefghijklmnopqrstuvwxyz'
    s=""
    while True:
        a=n%26
        if a==0:
            a=26
        s=abcd[a-1]+s
        n=int((n-a)/26)
        if n==0:
            break
    print(s)
resolve()

Submission status: Accepted

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

k=1

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

seq=[]
for i in range(k):
    seq.append(chr(ord("a")+n%26))
    n=n//26

seq.reverse()
s=""


for i in range(k):
    s+=seq[i]

print(s)

Submission status: Accepted

Solution code:

num = int(input())

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

print(n2a(num).lower())

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(str(num2alpha(int(input()))).lower())

Submission status: Accepted

Solution code:
N = int(input())
li = []
while(1):
    i = N % 26
    if i == 0:
        i += 25
        N -=1
    else:
        i -=1
    li.append(chr(97 + i))
    N = N // 26
    if N == 0:
        break

li.reverse()
for i in range(len(li)):
    print(li[i], end="")

Submission status: Accepted

Solution code:
n=int(input())-1
a=[]
for i in range(20):
    a.append(chr(n%26+97))
    n//=26
    n-=1
    if n==-1:
        break
for i in range(len(a)):
    print(a[-1-i],end='')

Submission status: Accepted

Solution code:
base = ord('a')

N = int(input())

data = []

while N:
    next, mod = divmod(N - 1, 26)
    data.append(mod)
    N = next

data.reverse()

for i in data:
    print(chr(base + i), end="")

Submission status: Accepted

Solution code:
n = int(input())
L = []
while n > 0:
    m = n // 26
    l = n % 26
    if l == 0:
        L.append(26)
        n = m-1
    else:
        L.append(l)
        n = m


def num2alpha(c): return chr(c+64)


for i in range(len(L)):
    t = L[-i - 1]
    print(num2alpha(t).lower(), end='')

Submission status: Accepted

Solution code:
N = int(input())
D = ["a", "b", "c", "d", "e", "f", "g",
     "h", "i", "j", "k", "l", "m", "n", "o",
     "p", "q", "r", "s", "t", "u", "v", "w",
     "x", "y", "z"]
A = []
while True:
    T = (N-1) % 26
    N = (N-1) // 26
    A.append(D[T])
    if N == 0:
        break
A = reversed(A)
print("".join(A))

Submission status: Accepted

Solution code:
N = int(input())

m = N
x = 26
cnt = 0
while True:
    cnt += 1
    if m <= x:
        break
    m -= x
    x *= 26

m -= 1
ofs = ord('a')
c = []
while cnt:
    y = m % 26
    c.append(chr(y+ofs))
    m //= 26
    cnt -= 1


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

Submission status: Accepted

Solution code:
N = int(input())

bit = []

for i in range(16):
    if N > 0:
        if N % 26 == 0:
            bit.append(26)
            N //= 26
            N -= 1
        else:
            bit.append(N % 26)
            N //= 26

appear = False
res = ""
for b in bit[::-1]:
    if (not appear) and b != 0:
        appear = True
    if appear:
        res = res + chr(96+b)

print(res)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    s = ""
    d = N
    while d:
        if d % 26 == 0:
            d, r = d // 26 - 1, 26
        else:
            d, r = d // 26, d % 26
        s += chr(r+64).lower()

    print("".join(list(reversed(s))))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    n = int(input())
    print(num2alpha(n).lower())

    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
l=[]
while n!=0:
    rem=n%26
    if rem==0:
        l.append('z')
        n=n//26
        n=n-1
    else:
        l.append(chr(97+(rem-1)))
        n=n//26
l.reverse()
print("".join(l))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())-1
def n_len():
    global n
    i=1
    while n>=26**i:
        n-=26**i
        i+=1
    return i
l=n_len()
alp=[chr(i) for i in range(97, 97+26)]
ans=""
for i in range(l):
    k=n%26
    ans=alp[k]+ans
    n//=26
print(ans)

Submission status: Accepted

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

def converter(n):
    L ="zabcdefghijklmnopqrstuvwxy"
    return L[n]

def solve(N: int):
    ans = ""
    num = N
    while True:
        p = num // 26
        q = num % 26
        ans = converter(q) + ans
        if q == 0:
            p -= 1
        if p <= 0:
            break
        num = p

    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
n=int(input())
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(n))

Submission status: Accepted

Solution code:
n=int(input())
n-=1
ans=chr(n%26+97)

while(n):
    n//=26
    n-=1
    if n<0:
        break
    ans=chr(n%26+97)+ans
    # print(n,chr(n%26+97),ans)
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
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=int(input())
n = num2alpha(a)
print(n.lower())

Submission status: Accepted

Solution code:
N = int(input())
A = 'abcdefghijklmnopqrstuvwxyz'
assert len(A) == 26

def f(n):
  if n < 26:
    return [A[n % 26]]
  return f((n // 26) - 1) + [A[n % 26]]

print(''.join(f(N - 1)))

Submission status: Accepted

Solution code:
N = int(input())
def change(x):
    if x==0: x=26
    return chr(ord('a')+int(x)-1)
def helper(N,x):
    if N<=26: return change(N)
    if (int(N/x)):
        if N%x !=0:
            return helper(int(N/x),x)+change(N%x)
        else:
            return helper(int(N/x)-1,x)+change(N%x)
print(helper(N,26))

Submission status: Accepted

Solution code:
import sys

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

N = int(read())

def main(N):
    A = [1]
    for _ in range(100):
        A.append(A[-1] * 26)
    for n in range(1, 100):
        # n 文字のは全て使い終わった
        if N > A[n]:
            N -= A[n]
            continue
        # n 文字の中で勝負をつける
        N -= 1
        ret = []
        for _ in range(n):
            N, r = divmod(N, 26)
            ret.append(r)
        break
    ret = [chr(ord('a') + x) for x in ret]
    return ''.join(reversed(ret))

print(main(N))

Submission status: Accepted

Solution code:
def create_alphabet(n):
    if n<=26:
        return chr(96+n)
    elif n%26==0:
        return create_alphabet(n//26-1)+chr(122)
    else:
        return create_alphabet(n//26)+chr(96+n%26)
        

n = int(input())
print(create_alphabet(n))

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
ans = []
while n > 0:
    tmp = n % 26
    ans.append(tmp)
    n = n // 26
    if tmp == 0:
        n-=1
a = []
for i, num in enumerate(ans):
    if num == 0:
        a.append('z')
    else:
        a.append(chr(ord('a') + num - 1))
a.reverse()
print(*a, sep='')

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())
u = num2alpha(n)
print(u.lower())

Submission status: Accepted

Solution code:
n = int(input())

alpha = ['z'] + [chr(i) for i in range(ord('a'),ord('z')+1)]
step = 0
result = ''
while(True):
    t = n % 26
    result = alpha[t] + result
    if n <=26:
        break
    n //= 26
    if t == 0:
        n -= 1

print(result)