-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.py
60 lines (50 loc) · 948 Bytes
/
C.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
N = int(input())
ans = ''
i = 1
while True:
if N <= 26**i:
N -= 1# a=1なので0に合わせる
for j in range(i):
ans += chr(ord('a') + N%26)# 26の時ord(a)+25
N //= 26
break
else:
N -= 26 ** i
i+=1
print(ans[::-1])
# N = int(input())
# 2 ans = ''
# 3 while N > 0:
# 4 N -= 1
# 5 ans += chr(ord('a') + N % 26)
# 6 N //= 26
# 7 print(ans[::-1])
# l = []
# ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
# i = 0
# pre = 0
# while N>26**i:
# i += 1
# i -= 1
# #l.append((N%26))
# #N -= N%26
# print(i)
# while N>26:
# l.append(N//(26**i)-1)
# N -= (N//26**i)*26**i
# i -= 1
# print(N)
# l.append(N)
# print(l)
# for i in l:
# print(ascii_lowercase[i-1], end='')
# print('')
# while N>26:
# l.append(N%26)
# N = (N//26)
# print(N)
# l.append(N%26)
# print(l[::-1])
# for i in l[::-1]:
# print(ascii_lowercase[i], end='')
# print('')