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

s = []
a = 26
tmp = 1
for i in range(20):
    s.append(tmp)
    tmp += a
    a *= 26
    if tmp > 100000000000000000:
        break

for i in range(len(s)):
    if N >= s[i]:
        continue
    else:
        size = i 
        break

b = N - s[size-1]

n2a = lambda c: chr(c+64)
a = 26 ** (size-1)

ans = []
while(a >= 1):
    ans.append(n2a(b // a + 1).lower())
    b %= a
    a //= 26

print(*ans, sep="")

Submission status: Accepted

Solution code:
n = int(input())
#n, k = [int(a) for a in input().split()]
#ps = [int(a) for a in input().split()]

a = []

remain = n

while remain != 0:
  t = int(remain % 26)
  a.append(t if t != 0 else 26)
  remain -= a[-1]
  remain /= 26
#a.append(int(remain))
tmp = ' abcdefghijklmnopqrstuvwxyz'
a.reverse()

print(''.join([tmp[i] for i in a]))

Submission status: Accepted

Solution code:
N = int(input())
ans = ""
al = "zabcdefghijklmnopqrstuvwxy"
while(N>26):
    x = N%26
    ans += al[N%26]
    N = N // 26
    if x == 0:
        N -= 1
ans += al[N%26]
ans = ans[::-1]
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)

ans = num2alpha(int(input()))

print(ans.lower())

Submission status: Accepted

Solution code:
n=int(input())

remains = []
while n > 26:
    if (n%26 == 0):
        remains.append(26)
        n = n//26 - 1
    else:
        remains.append(n%26)
        n = n//26 

remains.append(n)

ans = ''
for rem in remains:
    ans = ans + chr(ord('a')+ rem - 1)

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

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

if __name__ == '__main__': 
    print(alpha(N))

Submission status: Accepted

Solution code:
def main():
    import sys
    N = int(sys.stdin.readline())
    #s = sys.stdin.readline().rstrip()
    #N, K = map(int, sys.stdin.readline().split())
    #P = list(map(int, sys.stdin.readline().split()))
    #P.sort()
    #print(N)
    al = 'zabcdefghijklmnopqrstuvwxy'
    ans =''
    while True:
        if N==0:
            break
        ans +=al[(N %26)]
        if N%26==0:
            N = N//26 -1
        else:
            N = N//26
        
    print(ans[::-1])



if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = []
num = [26**i for i in range(15)]
for i in range(14):
    num[i+1] += num[i]

for i in range(14):
    if n < num[i]:
        ans = [0]*i
        n -= num[i-1]
        break

num = [26**i for i in range(len(ans))]
num.reverse()

for i in range(len(num)):
    count = 0
    while n >= num[i]:
        n -= num[i]
        count += 1
    ans[i] += count

ans = [chr(i+97) for i in ans]
print(*ans, sep = "")

Submission status: Accepted

Solution code:
N=int(input())

ans=""

while True:
    B = N % 26
    A = N // 26

    if N<27:
        ans= chr(N+96) + ans
        break
    if B==0:
        B=26
        N-=26
    ans= chr(B+96) + ans

    N = N // 26


print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n = 0
l = 0
while n < N:
    l += 1
    n += 26**l
cnt = [26**l for l in range(1, 12)]
n = sum(cnt[:l-1])
k = 1
s = ''
while k < l:
    i = 0
    while n+cnt[l-k-1] < N:
        i += 1
        n += cnt[l-k-1]
    s += chr(97+i)
    k += 1
s += chr(97+N-n-1)
print(s)

Submission status: Accepted

Solution code:
n = int(input())

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
name = ''
while(True):
    m = n%26
    if(m == 0):
        m = 26
        n -= 26
    name = alp[m-1] + name
    n = n//26
    if(n==0):
        break

print(name)

Submission status: Accepted

Solution code:
N = int(input()) - 1
A = [chr(i) for i in range(ord('a'), ord('z') + 1)]
ans = ''

while True:
    ans += A[N % 26]
    if N < 26:
        break
    N //= 26
    N -= 1 

print(ans[::-1])

Submission status: Accepted

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

n = int(input())

ans = []
while n > 0:
    if n%26 == 0:
        c = 26
    else:
        c = n%26
    ans.append(chr(c+96))
    if n%26 == 0:
        n = n//26 - 1
    else:
        n = n//26

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

Submission status: Accepted

Solution code:
A=int(input())
l=[chr(i) for i in range(97, 97+26)]
let=""
for i in range(100):
   if A%26==0:
      let="z"+let
      if A//26==1:
         break
      A=A//26-1
   else:
      let=l[A%26-1]+let
      A=A//26
   if A==0:
      break
print(let)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

MOD = 1000000007
INF = float('inf')
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"]
def keta(kazu): # 入力されたintを桁ごとに分解，リストで出力
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): # 最小公倍数
    return reduce(math.gcd, numbers)

def combination(m,n): # mCn
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def main():    
    n = int(stdin.readline().rstrip())
    ans = ""
    while n > 0:
        n -= 1
        kazu = n%26
        ans = alpha[kazu] + ans
        n = n//26
    print(ans)
    
main()

Submission status: Accepted

Solution code:
n = int(input())

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

s.append(n)

ans = ""
for x in s[::-1]:
    ans += chr(int(x) + 96)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=0
i=0
while k<=n:
	k+=26**i
	i+=1
p=i-1
r=[]
k-=26**(i-1)
n-=k
for i in range(p):
	r.append(n%26)
	n//=26
ans=""
for x in r:
	ans+=chr(ord("a")+x)
print(ans[::-1])

Submission status: Accepted

Solution code:
N=int(input())
LIST=[0]
for i in range(30):
    LIST.append(LIST[-1]+pow(26,i+1))

for i in range(29):
    if N<=LIST[i]:
        LEN=i
        break

for k in range(LEN):
    N-=pow(26,k)

ANS=[]
for i in range(LEN):
    ANS.append(N%26)
    N//=26

#print(ANS)

print("".join([chr(a+97) for a in ANS][::-1]))

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

al = "abcdefghijklmnopqrstuvwxyz"

def solve(N: int):
    i = 1
    n = ""
    while(N>0):
        m = N % 26 -1
        n = al[m] + n
        N = N // 26 - (m==-1)*1

    print(n)

    

    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:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def main():
    N = int(input())
    p = []
    a = N

    while a > 0:
        m = (a-1) % 26
        p.append(m)
        a = (a-1)//26

    # print(list(reversed(p)))
    # " abcdefghijklmnopqrstuvwxyz"
    print("".join([chr(ord('a')+n) for n in reversed(p)]))

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
n+=-1
lentharray=(26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286)
i0=0
i1=0
s="abcdefghijklmnopqrstuvwxyz"
for i in lentharray:
  i0+=1
  if n < i:
    break
  i1=i
i2=n-i1
r=[]
for j in range(i0):
  i3=i2%26
  r.append(s[i3])
  i2=i2//26
print("".join(reversed(r)))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

N = ini()


def solve():
    k = 26
    a = k
    p = k
    l = 1
    while a < N:
        p *= 26
        a += p
        l += 1
    b = 1
    x = N - 1
    name = [None] * l
    for i in range(l):
        c = x % 26
        name[l - 1 - i] = chr(ord("a") + c)
        x //= 26
        x -= 1
    return "".join(name)


print(solve())

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ANS = ""
    while N > 26:
        a = N % 26
        b= N // 26
        if a == 0:
            a = 26
            b -= 1
        ANS = str(chr(96 + a)) + ANS
        N = b
    ANS = str(chr(96 + N)) + ANS
    print(ANS)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import string
def resolve():
    N = int(input())-1
    lst = []
    while True:
        lst.append(N%26)
        N //= 26
        N-=1
        if N == -1:
            break
    lst.reverse()

    
    st = [string.ascii_lowercase[i] for i in lst]
    print("".join(st))
resolve()

Submission status: Accepted

Solution code:
n = int(input())
m = n
u = []
while(m != 0):
    u.append(m % 26)
    m = m // 26
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(u)-1):
    if(u[i] < 1):
        u[i] += 26
        u[i+1] -= 1
u.reverse()
ans = ''
for ss in u:
    ans += s[ss-1:ss]
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())
ans=num2alpha(N)
print(str.lower(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n):
    res = [None] * n
    for i in range(n):
        res[i] = II()
    return res
def LIR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI()
    return res
def FR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LFR(n):
    res = [None] * n
    for i in range(n):
        res[i] = IF()
    return res
def LIR_(n):
    res = [None] * n
    for i in range(n):
        res[i] = LI_()
    return res
def SR(n):
    res = [None] * n
    for i in range(n):
        res[i] = S()
    return res
def LSR(n):
    res = [None] * n
    for i in range(n):
        res[i] = LS()
    return res
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    ans = []
    while n:
        x = (n-1) % 26
        n = (n-1) // 26
        ans.append(chr(x + ord("a")))
    print("".join(ans[::-1]))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

k = []

while n > 0:
    y = n % 26
    k.append(l[y])
    n -= 1
    n //= 26
print(''.join(reversed(k)))

Submission status: Accepted

Solution code:
MOD=10**9+1
n=int(input())
ans=''
while n:
    ans=chr(ord('a')+(n+25)%26)+ans
    n=(n-1)//26
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = ord("a")
ansl = []
while n != 0:
	n -= 1
	k = n % 26
	ansl.append(chr(a+k))
	n //= 26
print("".join(ansl[::-1]))

Submission status: Accepted

Solution code:
n = int(input())
l = []

while(n > 0):
    l.append((n - 1) % 26)
    n = int((n - 1) / 26)

l.reverse()

ans = []
for i in l:
    ans.append(chr(i + ord('a')))
    
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())

s = ""
while n>0:
  rem = n%26
  if rem == 0:
    n = n - 1
    rem = 26
  s += chr(rem+96)
  n = n//26
  
print(s[::-1])

Submission status: Accepted

Solution code:
N = int(input())
alphas = [ chr(i) for i in range(ord("a"), ord("z")+1)]

res = ""
while N != 0:
  ch = N % 26
  if ch==0:
    res += alphas[-1]
    N = N//26
    N -= 1
  else:
    res += alphas[ch-1]
    N = N//26

print(res[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


BASE_CHR = 96
# chr(97) # a

result = ""

while True:
    temp = N % 26
    flag = False
    if temp == 0:
        result += "z"
        flag = True
    else:
        result += chr(BASE_CHR+temp)

    N = N // 26

    if flag:
        N -= 1

    if N == 0 :
        break

print(result[::-1])

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:
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:
n = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

for t in range(1, 30):
    if n > 26 ** t:
        n -= 26 ** t
    
    else:
        n -= 1
        ans = [0] * t
        for i in range(t):
            ans[i] = n % 26
            n //= 26

        ans = ans[::-1]
        s = ''
        for i in range(t):
            s += alp[ans[i]]

        print(s)
        break

Submission status: Accepted

Solution code:
n = int(input())
# n = 703

alphabets = [chr(97 + i) for i in range(26)]

x = []

m = n
while True:
    b = m % 26
    if b == 0:
        b = 26
        a = m // 26 - 1
    else:
        a = m // 26

    x.append(alphabets[b - 1])

    if a < 1:
        break

    m = a

print(''.join(reversed(x)))

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ct=1
    alp='abcdefghijklmnopqrstuvwxyz'
    for i in range(1,16):
        temp=n-26**i
        #print(temp)
        if temp<=0:
            n-=1
            break
        else:
            n=temp
            ct+=1
    
    
    name=['a']*ct
    n_t=[]
    
    while n!=0:
        a=n%26
        n_t.insert(0,alp[a])
        n=n//26
    l=len(n_t)
    #print(ct,l)
    #print(n_t)
    #print(name[0:ct-l])
    ans=name[0:ct-l]+n_t
    
    print(*ans,sep='')
        
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
N = int(input())

ans = ["" for _ in range(11)]
count = 0
while N > 0:

    remainder = N % 26
    if remainder ==0:
        remainder = 26
    ans[count] = chr(remainder + 96)
    N = (N-remainder)//26
    count += 1
print("".join(list(reversed(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)

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

Submission status: Accepted

Solution code:
n = int(input())

n = n - 1

root = 26
p = 1


while n >= root:
	n -= root
	root *= 26
	p += 1


res = ['a'] * p

while n > 0:
	r = n % 26
	res[p - 1] = chr(ord('a') + r)
	n = n // 26
	p -= 1

print(''.join(res))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    
    ans = ''
    while N:
        if N % 26 == 0:
            ans += "z"
            N -= 1
            N //= 26
        else:
            ans += chr((N % 26) -1  + 97)
            N //= 26

    print(ans[::-1])

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)

print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
def func(n):
    if n<=26:
        return chr(n+96)
    if n%26==0:
        return func(n//26-1)+'z'
    return func(n//26)+chr(n%26+96)


n=int(input())
print(func(n))

Submission status: Accepted

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

n = int(input())

sub = 26
count = 1
while True:
  if n <= sub:
    break
  n -= sub
  sub *= 26
  count += 1

ans = []
n -= 1
for i in range(count):
  ans.append(alphabet[n%26])
  n //= 26
ans.reverse()
print("".join(ans))

Submission status: Accepted

Solution code:
n=int(input())

niroku=[]
siji=[1]
for i in range(20):
    siji.append(siji[-1]*26)
siji[0]=0
keta=0
for i in range(20):
    if(n>siji[i]):
        n-=siji[i]
        keta=i+1
n-=1
#print(n,keta)

for i in range(keta):
    niroku.append(n%26)
    n//=26
#print(niroku)

ans=""
for ni in niroku:
    ans=chr(97+ni)+ans
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
dict={}
s='zabcdefghijklmnopqrstuvwxy'
for i in range(len(s)):
    dict[i]=s[i]
cnt=0
ans=""
while True:
    tmp=n%26
    ans=dict[tmp]+ans
    n//=26
    if tmp==0:
        n-=1
    if n<=0 :
        break
print(ans)

Submission status: Accepted

Solution code:
def digit(x):
    div = 26
    digit = 0
    while x>0:
        x -= div
        digit += 1
        div *= 26
    return digit, x + div//26

n = int(input())

keta, rem = digit(n)
div = 26**(keta-1)
ans = ""
for i in range(keta):
    a = rem // div
    b = rem % div
    
    if b==0:
        a -= 1
        b += div
    ans += chr(97+a)
    
    rem = b
    div //= 26
    
print(ans)

Submission status: Accepted

Solution code:
a=1000000000000001
n=int(input())
ans=""
tmp=[]
while n>=1:
  tmp.append((n-1)%26+1)
  n=(n-1)//26
for i in range(len(tmp)):
  ans=chr(ord('a')+tmp[i]-1)+ans
print(ans)

Submission status: Accepted

Solution code:
n = int(raw_input())
def f(n):
	r = []
	while(n):
		r.append(chr(ord('a') + (n-1)%26))
		n -=1
		n /= 26


	return ''.join(r[::-1])


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

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


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


main()

Submission status: Accepted

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

al = 'abcdefghijklmnopqrstuvwxyz'

def c_a(d, cs):
  nd = d // 26
  cd = d % 26
  if nd >= 26:
    cs = c_a(nd - 1, cs) + al[cd]
  elif nd == 0:
    cs = al[cd]
  else:
    cs = al[nd - 1] + al[cd]
  return cs

print(c_a(n, ''))

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    ans = []
    flag = 0
    n -= 1
    while True:
        x = n%26
        n //= 26
        ans.append(chr(x+97))
        if n == 0:
            break
        n -= 1
    ans.reverse()
    print(''.join(ans))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

# 1:a 2:b ... 26:z
# 26 + 1:aa
# 27 = 26 * 1 + 1 : aa
# 52 = 26 * 2 + 0 : az
# 53 = 26 * 2 + 1 : ba
# 26で割ったあまりの1-25をa-yに変換する
# 26で割り切れるときはzに変換して、繰り上げを一つ減らす

N = int(readline())

anum = ord("a")
def num_to_alpha(num):
  return chr(anum + num - 1)

ans = ""
while N:
  num = N % 26
  if num != 0:
    ans += num_to_alpha(num)
  else:
    ans += "z"
    N -= 1
  N //= 26
  
print(ans[::-1])

Submission status: Accepted

Solution code:
m = 1000000000000001

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())
c = 1
alphabet = [chr(ord('a') + i) for i in range(26)]
while n > 26**c:
    n -= 26**c
    c += 1
n -= 1

arg26 = []
n_dumy = n
while n_dumy>0:
    arg26.append(n_dumy%26)
    n_dumy = n_dumy//26

anslist = [alphabet[i] for i in arg26]
anslist.reverse()
if len(anslist) < c:
    anslist = [alphabet[0]]*(c - len(anslist)) + anslist
ans = ''.join(anslist)
print(ans)

Submission status: Accepted

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


ascii_lowercase = 'zabcdefghijklmnopqrstuvwxy'
import math
def main():
    n = input_int()

    kazu = len(ascii_lowercase)

    val = []
    temp = n
    while temp > kazu:
        amari = temp % kazu
        val.append(amari)
        syo = math.floor(temp / kazu)
        if amari == 0:
            temp = syo - 1
        else:
            temp = syo

    val.append(temp % kazu)

    ans = ""
    for v in val[::-1]:
        ans += ascii_lowercase[v]

    return ans


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

Submission status: Accepted

Solution code:
N = int(input())
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 N > 0:
  ans.append(A[N % 26])
  if N % 26 == 0:
    N = N // 26 - 1
  else:
    N = N // 26

  

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# n= input().split(" ")
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)

# ########関数部分##############
# def Base_10_to_n(X, n):
#     if (int(X/n)):
#         return Base_10_to_n(int(X/n), n)+str(X%n)
#     return str(X%n)
# ############################

# #####関数をつかってみる．#####
# ######今回は二進数に変換######
# x2 = Base_10_to_n(n,27)

print(num2alpha(n))

Submission status: Accepted

Solution code:
import math
import itertools
import collections
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
MOD = 10**9 + 7


n = IN()

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

print(str(num2alpha(n)).lower())

Submission status: Accepted

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

a=defs(n).lower()
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[]
t=0
while n>0:
    b=n%26
    if b==0:
        b=26
        t=1
    c=lambda b:chr(b+64)
    a.append(c(b))
    n//=26
    if t==1:
        n-=1
        t=0
d=len(a)
e=[]
for i in range(d):
    e.append(a[-1-i])
ans=''.join(e)
ans=ans.lower()
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    al = [chr(i) for i in range(97, 97 + 26)]
    name = []
    while True:
        n, mod = divmod(n-1, 26)
        name.append(al[mod])
        if n <= 0:
            break
    print("".join(name[::-1]))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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())-1
l = len(str(N))

ans = ''

if N == 0:
    print('a')
    exit(0)

cnt = 0
while N >= 26:
    d = N % 26
    ans = chr(ord('a') + d) + ans
    N //= 26
    N -= 1
ans = chr(ord('a') + N) + ans

print(ans)

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *                    # ll = deepcopy(l)
from heapq import *                    # heappush(hp,x)
from string import *                # alpha = ascii_lowercase
from random import *                # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *                # bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin                # bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize                # minn = -maxsize
from operator import *                # d = sorted(d.items(), key=itemgetter(1))
from itertools import *                # pre = [0] + list(accumulate(l))
from decimal import Decimal         # a = Decimal(a)    # use this for math questions
from collections import Counter        # d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(n):
    l = []
    i = 1
    while(26**i < 1000000000000001):
        l.append(26**i)
        i += 1
    # print(l,len(l))
    ans = ''
    i = len(l) - 1
    while(n and i >= 0):
        q = n // 26
        r = n % 26
        if(r):
            ans += chr(96+r)
            n //= 26
        else:
            ans += 'z'
            n //= 26
            n -= 1
    return ans[::-1]

    

N = int(stdin.readline())
ans = solve(N)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = [pow(26, i) for i in range(20)]
s[0] = 0
for i in range(20-1):
    s[i+1] += s[i]

for i in range(1,20):
    if n > s[i]:
        continue
    else:
        n = n - s[i-1] - 1
        ans = ''
        for j in range(1,i+1):
            idx = n // pow(26, i-j)
            ans += chr(0x61 + idx)
            n -= idx * pow(26, i-j)
        print(ans)
        break