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: Wrong Answer

Solution code:
s=["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())
a=[]
while(True):
    if n/26>1:
        a.append(n%26)
        n=n//26
    else:
        a.append(n%26)
        break
ans=""
for i in reversed(a):
    ans+=s[i-1]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

#print(N//26)

a = N
ans = ""
while a > 26:
  #print(a%26)
  ans = chr(a%26+96) + ans
  a = a//26
  
ans = chr(a+96) + ans
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a = 0
li = []
res =[]
for i in range(0,30):
    a += 26**i
    li = li + [a]
print(li)
for i in range(0,100):
    if li[i] <= n and n < li[i+1]:
        keta = i  #桁数がわかる
        break
while n > 26:
    hiku = n // li[keta]
    n -= li[keta] * hiku
    res+=[chr(hiku + 96)]
res += [chr(n + 97)]
print(''.join(res))

Submission status: Wrong Answer

Solution code:
n = int(input())
# a, b = divmod(n, 26)
alpha_arr = [chr(i) for i in range(97, 97+26)]
ans = []
# if b != 0:
#     ans.append(alpha_arr[b - 1])
# else:
#     ans.append('z')
a, b = divmod(n, 26)
if b != 0:
    ans.insert(0, alpha_arr[b - 1])
else:
    ans.insert(0, 'z')
while True:
    a, b = divmod(a, 26)
    if b != 0:
        ans.insert(0, alpha_arr[b - 1])
    else:
        ans.insert(0, 'z')
    if a < 26:
        break
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
from itertools import product
from string import ascii_lowercase
import math
import sys
n=int(input())
i=0
alphabets = ['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']
if n<=26:
    for combo in product(ascii_lowercase, repeat=1):
        if i==n-1:
            print(''.join(combo))
        i+=1
elif n<=702:
    for combo in product(ascii_lowercase, repeat=2):
        if i==n-26-1:
            print(''.join(combo))
        i+=1
elif n<=18278:
    for combo in product(ascii_lowercase, repeat=3):
        if i==n-702-1:
            print(''.join(combo))
        i+=1
elif n<=475254:
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-18278-1:
            print(''.join(combo))
        i+=1
elif n<= 12356630:
    if n==12356630:
        print("zzzzz")
        sys.exit()
    n=n-475254
    p=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+''.join(combo))
        i+=1
elif n<=321272406:
    if n==321272406:
        print("zzzzzz")
        sys.exit()
    n=n-12356630
    p=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[t]+''.join(combo))
        i+=1
elif n<=8353082582:
    if n==8353082582:
        print("zzzzzzz")
        sys.exit()
    n=n-321272406
    p=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=217180147158:
    if n==217180147158:
        print("zzzzzzzz")
        sys.exit()
    n=n-8353082582
    p=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=5646683826134:
    if n==5646683826134:
        print("zzzzzzzzz")
        sys.exit()
    n=n-217180147158
    p=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=146813779479510:
    if n==146813779479510:
        print("zzzzzzzzzz")
        sys.exit()
    n=n-5646683826134
    p=math.floor(n/5429503678976)
    n=n%5429503678976
    if n==5646683826134:
        print(alphabets[p]+"zzzzzzzzz")
        sys.exit()
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
else:
    n=n-146813779479510
    p=math.floor(n/141167095653376)
    n=n%141167095653376
    
    if n==146813779479510:
        print(alphabets[p]+"zzzzzzzzzz")
    k=math.floor(n/5429503678976)
    n=n%5429503678976
    
    if n==5646683826134:
        print(alphabets[p]+alphabets[k]+"zzzzzzzzz")
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[k]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(l)
            print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1

Submission status: Wrong Answer

Solution code:
N=int(input())

i=1
max_num=26
while(True):
	if N>max_num:
		i+=1
		max_num+=pow(26,i)
		continue
	else:
		l=[0]*i
		
		for x in range(i):
			if ((N//pow(26,i-x-1))+96)>122:
				l[x]=(N//pow(26,i-x-1))+96-1
				N-=pow(26,i-x-1)*(N//pow(26,i-x-1)-1)
				continue
			if ((N//pow(26,i-x-1))+96)<97:
				l[x]=(N//pow(26,i-x-1))+96+1
				N-=pow(26,i-x-1)*(N//pow(26,i-x-1)+1)
			else:
				l[x]=(N//pow(26,i-x-1))+96
				N-=pow(26,i-x-1)*(N//pow(26,i-x-1))
		res=''
		print(l)
		for n in l:
			res+=chr(n)
		print(res)
		break

Submission status: Wrong Answer

Solution code:
from itertools import product
n = int(input())
digits = 0
for i in range(16):
    if pow(26, i) < n <= pow(26, i + 1):
        digits = i + 1

alf = 'abcdefghijklmnopqrstuvwxyz'
ans = ''

num = pow(26, digits - 1)
while True:
    if 1 <= n <= 26:
        ans += alf[n - 1]
        break

    for i in range(1, 27):
        if i * num < n <= (i + 1) * num:
            ans += alf[i - 1]
            n -=i * num
            break
    num = num // 26


print(ans)

Submission status: Wrong Answer

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

def main():
    n = int(input())
    start = 0
    cnt = 0
    while 1:
        start += 26 ** cnt
        if start > n:
            start -= 26 ** cnt
            break
        cnt += 1
    ans = ''
    tmp = n
    for i in range(cnt - 1, -1, -1):
        shou = tmp // (26 ** i)
        tmp = tmp % (26 ** i)
        if tmp == 0 and i != 0:
            ans += 'z'
            continue
        if shou:
            ans += chr(ord('a') + shou - 1)
        else:
            ans += chr(ord('a') + tmp)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N=II()
crr=[chr(97 + i) for i in range(26)]

def calc(n, c):
    if c == 0: return ""
    if c == 1: n += 1
    # print(n, c)
    cnt = 0
    while n >= c+1:
        n -= c
        cnt += 1
    c //= 26
    if cnt > 0:
        return crr[cnt-1] + calc(n, c)
    else:
        return calc(n, c)

print(calc(N, 26**11))

Submission status: Wrong Answer

Solution code:
import math

arr = []

def saiki(N):
  hito = math.floor(N/26)
  pantu = N%26
  arr.append(pantu)
  if hito >= 26:
    return saiki(hito)
  else:
    return hito

def main():
  N = int(input())
  alphabet = [chr(i) for i in range(97, 97+26)]
  st = ""
  if N <= 26:
    print(alphabet[N-1])
  else:
    a = saiki(N)
    arr.reverse()
    for i in range(len(arr)):
      ans = arr[i] - 1
      st += alphabet[ans]
    st = alphabet[a-1] + st
    print(st)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
N = int(input())
ab = [chr(ord('a') + i) for i in range(26)]
j = 1
while True:
  temp = 1000000000000001//(26**j)
  j+=1
  if temp<1:
    break
ans = ''
for i in range(1, j+2):
  ax = (N//(26**(i-1)))%26-1
  if ax==0:
    ax = 25
  ans += ab[ax]
  if N//(26**i)<1:
    print(ans[::--1])
    sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
# print(N)

steps = 1
base = 26
number = [26]

while True:
  if N > base:
    steps += 1
    base += 26 ** steps
    number.append(base)
  else:
    base -= 26 ** steps
    # steps -= 1
    break

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

if base == 0:
  x = N
else:
  x = N % base

# print(steps, x)
  
letters = ""
base_26 = []

for i in range(1, steps + 1):
  if N >= 26 ** (steps - i):
    m = N // 26 ** (steps - i)
    if m == 27:
      base_26.append(N // 26 ** (steps - i) - 1)
      N -= 26 ** (steps - i) * (N // 26 ** (steps - i) - 1)
    else:
      base_26.append(N // 26 ** (steps - i))
      N -= 26 ** (steps - i) * (N // 26 ** (steps - i))
  else:
    # print("!")
    base_26.append(1)
    # letters += "a"

for i in base_26:
  letters += alphabet[i- 1]

print(letters)

Submission status: Wrong Answer

Solution code:
f=int(input())
def convert(n, f, cnt):
  if f-26**n<=0:
    return (f, cnt+1)
  else:
    return convert(n+1, f-26**n, cnt+1)
nu, digi=convert(1, f, 0)
st=""
li= ['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']
ch=[]
for i in range(digi):
  ch.insert(0, (nu%26))
  nu=nu//26
for _ in range(digi):
  if _==digi-1:
    st+=li[ch[_]-1]
  else:
    st+=li[ch[_]]
print(st)

    
    
#n=11からスタート
#n=int(input())
#text=base10to(n, 25)
#z=""
#for i in text:
 # z+=l[int(i)-1]
#print(text)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[chr(i) for i in range(97, 97+26)]
l=1
num=26

while N>=num:
    l+=1
    N-=num
    num*=26
ans=[]
for i in range(l):
    ans.append(N%26)
    N//=26
if sum(ans)==0:
    print("z"*(l-1))
else:
    ans[0]-=1
    an=""
    for j in ans[::-1]:
        an+=a[j]
    print(an)

Submission status: Wrong Answer

Solution code:
def main(N):
    alpha_num = 26
    Y = 96

    shou = [N]
    amari = []
    i = 0
    while shou[i] != 0:
        shou.append(shou[i] // alpha_num)
        amari.append(shou[i] % alpha_num)
        i += 1

    for i in range(len(amari)):
        while i < len(amari) and amari[i] <= 0:
            if i + 1 == len(amari):
                del amari[i]
            else:
                amari[i+1] -= 1
                amari[i] = alpha_num
    print(amari)
    # print(''.join([chr(Y + a) for a in reversed(amari)]))


if __name__ == '__main__':
    N = int(input())
    main(N)

Submission status: Wrong Answer

Solution code:
abc = ['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','z']

ans = []
def rec(n):
    #print(n,int(n/26),n%26,abc[n%26])
    ans.append(abc[n%26])
    #print(n)
    if n>=26:
        #ans.append(abc[int(n%26)-1])
        return rec(int(n/26))
        #ans.append(abc[int(n%26)])
        #print(n%26)
    else:
        pass
       #ans.append(abc[int(n)])
       #print(n%26)
N = int(input())
rec(N)
#i=N

for i in range(len(ans)-1,-1,-1):
    print(ans[i],end="")

Submission status: Wrong Answer

Solution code:
import math
import re
N=int(input())
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)
x26 = Base_10_to_n(N, 26)
#print(x26)
c=1
ayu=1
for i in range (12):
  ayu=str(ayu)+',0'
  if (x26==ayu):
    print('z'*c)
    exit()
  c=c+1
#print(x26[-1])

x26=(re.sub('0,', '', x26))
#print(x26)
x26=list(map(int,x26.split(',')))
#print(x26)
size = len(x26)
c=0
for i in range(size):
  ans=x26[c]
  c+=1
  if (chr(96+int(ans))=='`'):
    print('')
    continue
  print(chr(96+int(ans)), end='')

Submission status: Wrong Answer

Solution code:
N = int(input())

ch = ['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']

X = 1
count = 0
while X <= N:
    X = X*26
    count += 1
c = count-1

als = []
while c>0:
    alpha = N//(26**c)
    N = N%(26**c)
    c -= 1
    als.append(alpha)
als.append(N)

if als[-1] == 0:
    als[-2] = 26
    als= als[:-1]
    
ans = []
for i in range(len(als)):
    ans.append(ch[als[i]-1])
print(''.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
alph = "abcdefghijklmnopqrstuvwxyz"

ans = ""
while n >= 1:
    div, mod = divmod(n, 26)
    mod -= 1
    ans += alph[mod]
    n = div
print(ans[::-1])

Submission status: Wrong Answer

Solution code:
N = int(input())

def alf(n, edge):
    if n == 0:
        if edge:
            return 'z'
        else:
            return 'a'
    return chr(ord('a') + n -1)

ans = alf(N % 26 ,True)
cnt = 1

while True:
    if N <= 26 ** cnt:
        break
    ans =  alf((N // (26 ** cnt)) % 26, False) + ans
    cnt += 1

print(ans)

Submission status: Wrong Answer

Solution code:
f=int(input())
def convert(n, f, cnt):
  if f-26**n<=0:
    return (f, cnt+1)
  else:
    return convert(n+1, f-26**n, cnt+1)
print(convert(1, f, 0))
nu, digi=convert(1, f, 0)
st=""
li= ['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']
ch=[]
for i in range(digi):
  ch.insert(0, (nu%26))
  nu=nu//26
print(ch)
for _ in range(digi):
  if _==digi-1:
    st+=li[ch[_]-1]
  else:
    st+=li[ch[_]]
print(st)

    
    
#n=11からスタート
#n=int(input())
#text=base10to(n, 25)
#z=""
#for i in text:
 # z+=l[int(i)-1]
#print(text)

Submission status: Wrong Answer

Solution code:
n=int(input())
s='aabcdefghijklmnopqrstuvwxyz'

l=[]
while n>=1:
  if n<27:
    l.append(n)
    break
  l.append(n%26)
  
  n=n//26

ss=str()
for i in range(len(l)-1,-1,-1):
  ss+=s[l[i]]
print(str(ss))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
N = int(input())
ab = [chr(ord('a') + i) for i in range(26)]
j = 1
while True:
  temp = 1000000000000001//(26**j)
  j+=1
  if temp<1:
    break
ans = ''
for i in range(1, j+2):
  ax = (N//(26**(i-1)))%26
  if ax==0:
    ax = 25
  ans += ab[ax]
  if N//(26**i)<1:
    print(ans[::-1])
    sys.exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[chr(ord('a') + i) for i in range(26)]
l=[]
cnt=0
inc=1
while True:
  cnt+=26**inc
  if cnt>=n:
    #print(inc)
    break
  inc+=1
s=0
if n<=26:
  l.append(n)
for i in range(inc-1,0,-1):
  #print('i',i)
  x=n//26**(i)
  l.append(x)
  n=n-x*26**i
  #print("n",n,x)
  if n<=26:
    l.append(n)

ans=""
#print(l)
for li in l:
  if li==0:
    li=26
  ans+=chr(ord('a') + li-1)
print(ans)

Submission status: Wrong Answer

Solution code:
import string
N = int(input())
alphabet = list(string.ascii_lowercase)

def Base_10_to_n(X, n):
    X_dumy = X
    out = []
    while X_dumy>0:
        out.append(X_dumy%n)
        X_dumy = int(X_dumy/n)
    return out

ans = ''
for i in Base_10_to_n(N, 26)[::-1]:
    ans += alphabet[i-1]
print(ans)