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:
answer = ""
num = int(input())
j = 0
while(num > 0):
    j = num % 26
    num = num // 26
    if j == 0:
        answer += 'z'
        num -= 1
    else:
        answer += chr(96+j)

print(answer[::-1])

Submission status: Accepted

Solution code:

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


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

    ans = []
    while True:
        r, q = divmod(n, 26)
        c = get_char(q)
        ans.append(c)
        if r == 0:
            break
        n -= q
        n //= 26
        n -= 1
    
    print("".join(reversed(ans)))
    

submit()

Submission status: Accepted

Solution code:
n = int(input())
T =[]
S = ""
while n>0:
  if n%26==0:
    T.insert(0, 26)
    n = n//26 -1 
  else:
    T.insert(0, n%26)
    n = n//26
for t in T:
  S += chr(t+96)
print(S)

Submission status: Accepted

Solution code:
n = int(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
for i in range(1, 12):
    if n <= 26 ** i:
        n -= 1
        for _ in range(i):
            ans += alphabet[n % 26]
            n //= 26
        break
    else:
        n -= 26 ** i
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())

res = ""


d = 26


while N :
    N-=1
    c = N% 26
    res += chr(97+c)
    N //=26

print(res[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
digit = 26
now = 26
c = 1
while now < N:
    digit *= 26
    now += digit
    c += 1
now = now - digit
N = N - now -1
ans = ''
for i in range(c):
    ans += chr(97+N%26)
    N //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
n -= 1
ans = []
while n >= 0:
  ans.append(chr(ord("a")+n%26))
  n //= 26
  n -= 1
print(*ans[::-1],sep="")

Submission status: Accepted

Solution code:
N = int(input())
alfa=["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:
    N -= 1
    name += alfa[N % 26]
    N //= 26

print(name[::-1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
namelist=[]
name=''
while n>0:
  n-=1
  namelist.append(chr(ord('a')+n%26))
  n=int(n/26)
for i in namelist[::-1]:
  name+=i
print(name)

Submission status: Accepted

Solution code:
n=int(input())
 
cnt=0
tmp=0
 
while n>tmp:
    cnt+=1
    tmp+=26**cnt
 
num=n-(tmp//26)

ans=["0"]*cnt

for i in range(1, cnt+1):
    j=num%26
    num//=26
    add=chr(ord("a")+j)
    ans[-i]=add

print(*ans, sep='')

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
for i in range(1, 10000):
#     print(N)
#     print("-> ",26 ** i)
    if N <= 26 ** i: 
#         print("ok")
        N += -1
        for j in range(i):
#             print("N:", N)
#             print("N % 26:", N % 26)
            ans += chr(ord('a') + N % 26)
            N = N // 26  # 26で割った商
        break
    else:
        N -= 26 ** i

print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input()) 
ans=""
while N>0:
    N -= 1
    ans += chr(ord('a') + N % 26) 
    N //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())

name = ["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"]
cnt = []

while n != 0:
    cnt.append(n%26)
    n = n//26

for i in range(0, len(cnt)-1):
    if cnt[i] <= 0:
        cnt[i] += 26
        cnt[i+1] -= 1
cnt.reverse()
if cnt[0] == 0:
    del cnt[0]

ans = ""
for i in cnt:
    ans += name[i-1]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
keta=0
n=N
ketakari=0
while(1):
    keta+=1
    ketakari+=26**keta
    if N<=ketakari:
        break
for j in range(1,keta):
    N-=26**j
ans=""
#print(keta)
#print(ans)
#print(N)
N-=1
for i in range(keta):
    kari=N%26
    ans=chr(ord("a")+kari)+ans
    N//=26
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = []
while x>0:
	tmp = x%26
	ans.append(tmp)
	if tmp==0:
		x -= 26
	else:
		x -= tmp
	x //= 26

l = len(ans)
for i in range(l-1):
	if ans[l-i-1]==0:
		print('z',end="")
	else:
		print(chr(ord('a')+ans[l-i-1]-1),end="")

if ans[0]==0:
	print('z')
else:
	print(chr(ord('a')+ans[0]-1))

Submission status: Accepted

Solution code:
import sys
import time
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

K = int(input())

ans = ""
p = K
while p > 0:
  p -= 1
  q = p%26
  ans += chr(q + ord("a"))
  p = p//26
print(ans[::-1])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [1]
    ret = []
    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 -= 1
        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())

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from string import ascii_lowercase as al

n = int(input())
res = ''
while n: n -= 1; res += al[int(n % 26)]; n //= 26
print(res[::-1])

Submission status: Accepted

Solution code:
N = int(input())

for i in range(11):
    if N <= 26 ** (i + 1):
        size = i + 1
        break
    N -= 26 ** (i + 1)

ans = [0] * size
N -= 1
for i in range(size):
    q = N // 26
    r = N % 26
    N = q
    ans[size - 1 - i] = r

ans_chr = ''
for i in range(size):
    ans_chr += chr(ans[i] + 97)

print(ans_chr)

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
while n:
    n -= 1
    ans += chr(ord('a')+n%26)
    n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
import string
b = string.ascii_letters
a = int(input())
c = []
while(a>0):
  a-=1
  c.append(b[a%26])
  a=a//26
c.reverse()
print(''.join(c))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())

index = []
while N > 0:
    N -= 1
    digit = N % 26
    index.append(digit)

    N -= digit
    N //= 26



ans = []
change = list("abcdefghijklmnopqrstuvwxyz")

# print(index)
index.reverse()


for i in range(len(index)):
    ans.append(change[index[i]])


print("".join(ans))

Submission status: Accepted

Solution code:
x=int(input())
a=1
t=0
while t==0:
	if x-26**a>0:
		x=x-26**a
		a=a+1
	else:
		t=1
y=a-1
x=x-1
ans=[]
for i in range(a):
	ans.extend(chr((x//26**y)+97))
	x=x-(x//26**y)*26**y
	y=y-1

print(*ans,sep='')

Submission status: Accepted

Solution code:
N = int(input())
n = N

L = str()

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

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


N -= 26 * (26 ** (i - 1) - 1) // 25

while i > 0:
    code = (N - 1) // (26 ** (i - 1))
    L += alpha[code]
    N -= code * (26 ** (i -1))
    i -= 1

print(L)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = ""
    while N > 0:
        N -= 1
        ans += chr(97 + N%26)
        N //= 26
    print(ans[::-1])

main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

n=int(input())
ans=[]
while n>0:
  n-=1
  remain=n%26
  ans.append(remain)
  n=(n)//26
  
ans.reverse()
aa=[]
for i in ans:
  aa_=chr(ord('a')+i)
  aa.append(aa_)
  
print(''.join(aa))

Submission status: Accepted

Solution code:
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ANS1 = []
ans = ''
while n > 0:
    n -= 1
    ANS1.append(n % 26)
    n //= 26
for i in ANS1[::-1]:
    ans += s[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T = N
KISU = 26
Y = []
A = [chr(ord('a') + i) for i in range(26)]
ans = ''
S1 = 0
S1 = 25 if S1 == 0 else S1
while True:
  if T == 0:
    break
  S1 = (T % KISU)
  S1 = 26 if S1 == 0 else S1
  Y.append(S1)
  if S1 == 26:
    T -= 1
  T = T//KISU
for n in Y[::-1]:
  ans += A[n - 1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = ''
for i in range(1,99):
    if N <= 26**i:
        N-=1
        for j in range(i):
            ans = chr(ord('a')+(N%26)) + ans
            N = N // 26
        break;
    else:
        N -= 26**i

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
name=""
for i in range(15):
  n=n-1
  name=name+chr(97+n%26)
  n=n//26
  if n==0:
    break
print(name[::-1])

Submission status: Accepted

Solution code:
d = 1000000000000001
n = int(input())
abc = "abcdefghijklmnopqrstuvwxyz"
l = len(abc)

a = 1
while True:
    if n <= l**a:
        break
    n -= l**a
    a += 1
namelen = a

n -= 1
list = []
while True:
    if n < l:
        list.append(n)
        break
    list.append(n % l)
    n = n // l

namelist = ["a"]*namelen

for i in range(len(list)):
    namelist[-i-1] = abc[list[i]]

name = "".join(namelist)
print(name)

Submission status: Accepted

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


def f(n):
    if n == 0:
        return ''

    n -= 1
    return f(n // 26) + chr(ord('a') + n % 26)


N = int(input())
print(f(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
c = ""
while(n!=0):
    n-=1
    c+=chr(ord('a')+n%26)
    n=n//26
print(c[::-1])

Submission status: Accepted

Solution code:
s = int(input())
c= ""
while(s!=0):
    s-=1
    c+=chr(ord('a')+s%26)
    s=s//26
print(c[::-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def numeric_naming(N,M):
    result = []
    added_number = 1

    while N > 0 :
        result.append(0)
        if added_number == 0:
            result[-1] -= 1

        added_number = N % M

        result[-1] += added_number
        
        if result[-1] < 0:
            result[-1] = M -1 
        if result[-1] == 0:
            result[-1] = M
            added_number = 0

        N = N // M

    if result[-1] == M:
        del result[-1]

    result.reverse()
    print(''.join([chr(i + 96) for i in result]))


M = 26
numeric_naming(int(input()),M)

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


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

Submission status: Accepted

Solution code:
N = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
output = ""
while N>0:
  N -= 1
  output += alp[N%26]
  N = N//26
  
print(output[::-1])

Submission status: Accepted

Solution code:
alfabeto = "abcdefghijklmnopqrstuvwxyz"

n = int(input())
resposta = ""

for i in range(1, 99):
    if n <= 26 ** i:
        n -= 1

        for j in range(i):
            resposta += chr(ord("a") + n % 26)
            n //= 26

        break

    else:
        n -= 26 ** i

resposta = resposta[::-1]

print(resposta)

Submission status: Accepted

Solution code:
a = int(input())
i = 0
s = [chr(ord('a') + i) for i in range(26)]
b = []
while a >= 1:
  b.append(s[a%26-1])
  a = (a-1) // 26
  i += 1
  
print(''.join(b)[::-1])

Submission status: Accepted

Solution code:
n = int(input())

ans = ""
while n != 0:
  if n % 26 == 0:
    ans = "z" + ans
    n = n // 26 - 1
  else:
    ans = chr(ord("a") - 1 + n % 26) + ans
    n = n // 26
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
ans = ''
while N > 0:
    N -= 1
    ans += chr(ord('a')+N%26)
    N //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
## necessary imports
import sys
input = sys.stdin.readline
#from math import ceil, floor, factorial;

# swap_array function
def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp

## gcd function
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

## nCr function efficient using Binomial Cofficient
def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return int(res) 

## upper bound function code -- such that e in a[:i] e < x;
def upper_bound(a, x, lo=0):
    hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo

## prime factorization
def primefs(n):
    ## if n == 1    ## calculating primes
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    ## prime factoriazation of n is stored in dictionary
    ## primes and can be accesed. O(sqrt n)
    return primes

## MODULAR EXPONENTIATION FUNCTION
def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 

## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b

# find function with path compression included (recursive)
# def find(x, link):
#     if link[x] == x:
#         return x
#     link[x] = find(link[x], link);
#     return link[x];

# find function with path compression (ITERATIVE)
def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;


# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x

## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime

#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e7 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    ## function for storing smallest prime factors (spf) in the array

################## un-comment below 2 lines when using factorization #################
# spf = [0 for i in range(MAXN)]
# spf_sieve() 
def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    ## this function is useful for multiple queries only, o/w use
    ## primefs function above. complexity O(log n)

## taking integer array input
def int_array():
    return list(map(int, input().strip().split()))
## taking string array input
def str_array():
    return input().strip().split();

#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');

################### ---------------- TEMPLATE ENDS HERE ---------------- ###################

n = int(input()); ans = '';
alps = [chr(i) for i in range(97, 97 + 26)];
while(n):
    x = alps[(n % 26) - 1];
    ans = x + ans;
    n = (n-1)//26;
print(ans);

Submission status: Accepted

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

Submission status: Accepted

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

while n > 0:
  n -= 1
  r = n % 26
  n = n // 26
  name.append(chr(97+r))

name.reverse()
print("".join(name))

Submission status: Accepted

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

def f(n):
    p = 0
    ans=[]
    while True:
        if n >= 26**(p+1):
            n -=26**(p+1)
            p+=1
        else:
            for i in range(p+1):
                ans.append( chr( ord('a') + n%26 ) )
                n //= 26
            break
    print(''.join(reversed(ans)))

f(n)

Submission status: Accepted

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

while n/26 >= (1/26):
    m=n%26
    n=n//26
    if m == 0:
        n -= 1
    ans.insert(0,l[m-1])
print("".join(ans))

Submission status: Accepted

Solution code:
import itertools
import bisect



n = int(input())
al = [0 for _ in range(26)]
for i in range(97,123):
    al[i-97] = chr(i)
#print(al)

sm = [0 for _ in range(20)]
for i in range(1,20):
    sm[i] = int(26*(26**i - 1)/25)

#print(sm[4])

xx = bisect.bisect_left(sm, n)
#print(xx)
if(xx > 1):
    rd = n - sm[xx-1]
    ans = []
    tmp = [0 for _ in range(30)]
    for i in range(xx):
        if(xx > 1):
            unt = 26**(xx-i-1)
        if(rd >= unt):
            tmp = [j*unt for j in range(30)]
            num = bisect.bisect_left(tmp,rd)
            ans.append(al[num-1])
            rd -= tmp[num-1]
            #print(rd)
        else:
            ans.append("a")

    print("".join(ans))

else:
    print(al[n-1])

Submission status: Accepted

Solution code:
#from editorial
N = int(input()) 
ans = ''
for i in range(1, 99):
    if N <= 26 ** i: 
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26) 
            N //= 26
        break 
    else:
        N -= 26 ** i
print(ans[::-1]) # reversed

Submission status: Accepted

Solution code:
N = int(input())
t = N
d = 1
s = ''

while t-26**d > 0:
    t -= 26**d
    d += 1
t -= 1

while t > 0:
    r = t % 26
    t //= 26
    s += chr(r+ord('a'))

s += 'a' * max(0, d-len(s))
print(s[::-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)


# input
N = int(input())

# check
print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
while N > 0:
    N -= 1
    ans += chr(ord('a') + N % 26)
    N //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
num = int(input())
data = []
dataAlpha = []

def div_sho(a):
  sho = a // 26
  if a % 26 == 0:
    sho -= 1
  return sho

def div_amari(a):
  amari = a % 26
  if amari == 0:
    amari = 26
  return amari

while num > 26:
  data.append(div_amari(num))
  num = div_sho(num)
  
data.append(num)
data.reverse()

for d in data:
  dataAlpha.append(chr(d + 96))

print("".join(dataAlpha))

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

text = [chr(i) for i in range(97, 97+26)]
result = [] 

count=1
while True:
    if N > pow(26,count):
        N -= pow(26,count)
        count +=1
    else:
        break

N-=1
while True:
    if N!=0:
        result.append(text[N%26])
        N=N//26
    elif count!=len(result):
        result.append(text[0])
    else:
        break

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

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

n=ii()
s="abcdefghijklmnopqrstuvwxyz"
ans=""
while(n>0):
    n-=1
    ans+=s[n%26]
    n//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
import string,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
abc = string.ascii_lowercase
def main(N):
    if N<=26:
        return abc[N-1]
    if N%26==0:
        return main(N//26-1)+abc[-1]
    return main(N//26)+abc[N%26-1]
print(main(N))

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    s=""
    while n:
        n-=1
        s=chr(ord('a') + n%26)+s
        n//=26
    print(s)
main()

Submission status: Accepted

Solution code:
import sys

input_data = []
input_pointer = 0

output_data = []

def input_scan():
    global input_data
    input_data = sys.stdin.readlines()
    input_data = [x[:-1] for x in input_data]

def next_line():
    global input_pointer
    global input_data
    if input_pointer < len(input_data):
        input_pointer += 1
        return input_data[input_pointer - 1]
    else:
        return ""

def append_output(string):
    global output_data
    output_data.append(string)

def print_output():
    global output_data
    output_data.append("")
    sys.stdout.write("\n".join(output_data))

# Problem A
# alpha = input()
# if alpha.isupper():
#     print("A")
# else:
#     print("a")

# Problem B
# input_scan()
# [n, k] = [int(x) for x in next_line().split(" ")]
# fruits = sorted([int(x) for x in next_line().split(" ")])
# print(sum(fruits[:k]))

# Problem C
num = int(input())

dictionary = "abcdefghijklmnopqrstuvwxyz"

def convert_to_alpha(num):
    if num == 0:
        return ""
    quot = num // 26
    rem = num % 26
    if rem == 0:
        return "z" + convert_to_alpha(quot - 1)
    else:
        return dictionary[rem - 1] + convert_to_alpha(quot)

name = ""
print("".join(reversed(convert_to_alpha(num))))

Submission status: Accepted

Solution code:
import string
import math

n = int(input())
alp = string.ascii_lowercase

keta = int( math.log(n * 25 + 1, 26) )

st = (26 ** keta - 1 ) // 25
n2 = n - st
ans = []
for i in range(keta):
  ans.append( alp[ n2 % 26 ] )
  n2 = n2 // 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
n=int(input())
l=[]
while(n):
  n-=1
  x=n%26
 
  l.insert(0,chr(( x) + ord('a')))
  n//=26
print("".join(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans=''
N=II()
N-=1
for l in range(1,15):
  if N>=26**l:
    N-=26**l
    continue
  for i in range(l):
    d=N%26
    ans+=chr(d+ord('a'))
    N//=26
  ans=ans[::-1]
  break
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


n=IN()
ans=" "
while n>0:
    b=n%26
    if b==0:
        ans='z'+ans
        n=n//26
        n-=1
    else:
        ans=chr(ord('a')+b-1)+ans
        n//=26
print(ans)

Submission status: Accepted

Solution code:
def II(): return int(input())
N=II()
N-=1
ans=''
for l in range(1,15):
  if N>=26**l:
    N-=26**l
    continue
  for i in range(l):
    d=N%26
    ans+=chr(d+ord('a'))
    N//=26
  ans=ans[::-1]
  break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
問題の解釈
長さがlであるような文字列の中で辞書順でk番目のものを求めよ

26進表記における位の値の求め方
1. 変数xをk-1で初期化し、xが0となるまで以下の操作を繰り返す
2. xを26で割った商がq、余りがrであるとする。この操作がi回目に実行された時のrがk-1の下からi番目の桁である。xをqで置き換える
"""
ALPHABET = "abcdefghijklmnopqrstuvwxyz"

n = int(input())

# 長さの判定
# 26 **11 > 10*15より
ll = 0
for l in range(1, 12):
    ll += 26**l
    if ll >= n:
        break

ans = []
for li in range(1, l+1):
    r = n % 26
    q = n // 26
    if r == 0:
        q -= 1
    ans.append(r)
    n = q

answer = ""
for s in ans[::-1]:
    answer += ALPHABET[s-1] 
print(answer)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    #l:=名前の長さ
    #まずはlを求める
    l = 1
    while N - 26 ** l > 0:
        N -= 26**l 
        l += 1
    #長さlの名前のうちN番目（Nの値は上のwhileで更新してあるので注意）の名前を求める
    #aからzを0から25に対応させ26進数としてNを表せばその文字列が答えとなっている
    #上位の桁はaで埋めることに注意する
    N -= 1
    ans = ""
    for _ in range(l):
        ans += chr(ord('a')+N%26)
        N //= 26
    print(ans[::-1])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
k=0
c=0
while True:
    if c+1<=n<=26**(k+1)+c:
        k+=1
        break
    k+=1
    c+=26**k

if k==1:
    print(chr(96+n))
    exit()

l=[]
n-=c #その桁数の何番めか
for i in range(1,k+1):
    k1=n//26**(k-i)
    l.append(k1)
    n-=26**(k-i)*(k1-1)

l1=[]
for i in range(1,len(l)+1):
    if l[-i]>=27:
        l[-(i+1)]+=1
        l[-i]-=26
    l1.append(chr(96+l[-i]))

l2=[]
for i in range(1,len(l1)+1):
    l2.append(l1[-i])
print(''.join(l2))

Submission status: Accepted

Solution code:
def solve(N):
    if N < 26:
        return chr(ord('a') + (N) % 26)
    else:
        return solve(N // 26 - 1) + chr(ord('a') + N % 26)

print(solve(int(input()) - 1))

Submission status: Accepted

Solution code:
#create date: 2020-06-29 09:33

import sys
stdin = sys.stdin


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

def f(n):
    res = str()
    while n:
        m = (n-1) % 26
        n = (n-1) // 26
        res = chr(ord("a") + m) + res
    return res

def main():
    n = ni()
    print(f(n))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

def main(n):
    """ main
    """
    result = []

    n = n - 1

    while True:
        result.append(chr(97 + n%26))
        n = int(n / 26) - 1

        if n < 0:
            break

    result.reverse()

    return "".join(result)

if __name__ == "__main__":
    N = int(sys.stdin.readline())

    print(main(N))

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    alpahbet = [chr(ord("a") + i) for i in range(26)]

    ans = []
    while N:
        N -= 1
        ans.append(alpahbet[N % 26])
        N //= 26

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
Ans = ""
while N>0:
    s = N%26
    if s == 0:
        s = 26
    N = int((N - s)/26)
    Ans = chr(ord("a")+s-1)+Ans

print(Ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
for i in range(1,100):
    if n <= 26**i:
        n -= 1
        for j in range(i): #下の位から桁を決める
            ans += chr(ord('a')+ n % 26) #演算子は足し算より掛け算系優先
            n //= 26
        break
    else:
        n -= 26**i
print(ans[::-1]) #[::-1]で反転できる

#ord()は文字の番号を示す
#chr()はその番号の文字を示す
#bin(),oct(),hex()はそれぞれ2,8,16進数に変換し、数字の前に0b,0o,0xがつく

Submission status: Accepted

Solution code:
N = int(input())
li = list(chr(i) for i in range(97, 123))
ans = ''
while N > 0:
    N -= 1
    ans += li[N % 26]
    N //= 26
print(ans[::-1])

Submission status: Accepted

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

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

    # どの桁帯にいるかを求める
    b = 1
    d = 26
    num = 26
    while N > num:
        b += 1
        d *= 26
        num += d

    N = N - (num - d)
    N -= 1  # 0-indexedにする

    # 26進数で答えを求める
    ans = ""
    for i in range(b-1, -1, -1):
        a = N//(26**i)
        ans += chr(97+a)
        N -= (26**i)*a

    print(ans)


if __name__ == "__main__":
    solve()