Problem: 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?"

Submission attempts (in order):



N = int(input())  
K = 26  

al = [chr(i) for i in range(97, 97+K)]


def change(N):
    
    keta = 0
    
    
    tmp = 0
    for i in range(10**9):
        if N < K**i + tmp:
            keta = i
            break
        tmp += K**i
    ans = [0] * keta  
    

    
    check = 0
    for i in range(1, keta+1):
        j = N // (K ** (keta - i))
        if j * (K ** (keta - i)) == N and i != keta:
            j -= 1
        N -= j * (K**(keta-i))
        ans[check] = j
        check += 1
    return ans


for i in change(N):
    print(al[i-1], end='')





N = int(input())  
K = 26  

al = [chr(i) for i in range(97, 97+K)]


def change(N):
    
    keta = 0
    
    
    tmp = 0
    for i in range(10**9):
        if N < K**i + tmp:
            keta = i
            break
        tmp += K**i
    ans = [0] * keta  
    

    
    check = 0
    for i in range(1, keta+1):
        j = N // (K ** (keta - i))
        if j == 27:
            j -= 1
        if i != keta and j * (K ** (keta - i)) == N:
            j -= 1
        N -= j * (K**(keta - i))
        ans[check] = j
        check += 1
    # print(ans)
    return ans


for i in change(N):
    print(al[i-1], end='')


# coding: utf-8
# Your code here!

N=int(input())
K=26

al = [chr(i) for i in range(97, 97+K)]

def change(N):
    keta=0
    
    for i in range(10**9):
        if N <= K**i:
             keta = i
             break
    ans=[0]*keta 
    check=0
    for i in range(1,keta+1):
        j = N//(K**(keta-i))
        ans[check]=j
        check+=1
        N-=(j)*(K**(keta-i))
    return ans
    
for i in change(N):
    print(al[i-1],end = '')
   


# coding: utf-8
# Your code here!

N=int(input())
K=26

al = [chr(i) for i in range(97, 97+K)]

def change(N):
    keta=0
    
    tmp = 0
    for i in range(10**9):
        if N < K**i + tmp:
             keta = i
             break
        tmp += K**i
    ans=[0]*keta 
    check=0
    for i in range(1,keta+1):
        j = N//(K**(keta-i))
        ans[check]=j
        check+=1
        N-=(j)*(K**(keta-i))
    return ans
    
for i in change(N):
    print(al[i-1],end = '')
   





N = int(input())  
K = 26  

al = [chr(i) for i in range(97, 97+K)]


def change(N):
    
    keta = 0
    
    
    tmp = 0
    for i in range(10**9):
        if N < K**i + tmp:
            keta = i
            break
        tmp += K**i
    ans = [0] * keta  
    print(tmp)
    

    
    check = 0
    for i in range(1, keta+1):
        j = N // (K ** (keta - i))
        print(j, N - (j * (K ** (keta - i))))
        if i != keta and N - (j * (K ** (keta - i))) < tmp:
            j -= 1
        if j == 27:
            j -= 1
        N -= j * (K ** (keta - i))
        tmp -= K**(keta - i)
        ans[check] = j
        check += 1
    # print(ans)
    return ans


for i in change(N):
    print(al[i-1], end='')


# coding: utf-8
# Your code here!

N=int(input())
K=26

al = [chr(i) for i in range(97, 97+K)]

def change(N):
    keta=0
    
    tmp = 0
    for i in range(10**9):
        if N < K**i + tmp:
            keta = i
            break
        tmp += K**i
    ans=[0]*keta 
    check=0
    for i in range(1,keta+1):
        j = N//(K**(keta-i))
        if(j == 27):
            j -= 1
        ans[check] = j
        check += 1
        N -= j * (K**(keta-i))
    return ans
    
for i in change(N):
    print(al[i-1], end = '')
   




def main():
    N = int(input())
    digits = []

    while N != 0:
        digits.append(N % 26)
        if digits[-1] == 0:
            digits[-1] = 26
            N //= 26
            N -= 1
        else:
            N //= 26
    digits.reverse()
    for d in digits:
        print(chr(96 + d), end='')
    print()  


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted