Skip to content

Instantly share code, notes, and snippets.

@uchidama
Created July 12, 2021 05:14
Show Gist options
  • Save uchidama/7eb402a8bd4ad918438a235d0796e3ce to your computer and use it in GitHub Desktop.
Save uchidama/7eb402a8bd4ad918438a235d0796e3ce to your computer and use it in GitHub Desktop.
AtCoder Beginner Contest 171 [ C - One Quadrillion and One Dalmatians ] https://atcoder.jp/contests/abc171/tasks/abc171_c
'''
https://atcoder.jp/contests/abc171/tasks/abc171_c
問題の例に「0をどう変換するか?」書いてないところがポイントなのかなー?
そこから一歩進んだ考察するべき?
[参考]
https://blog.hamayanhamayan.com/entry/2020/06/23/193042
 基本はまやんさんのコードをPythonにコンバート
https://drken1215.hatenablog.com/entry/2020/06/21/225500
27=aa と入力例ではなってる。
26進数では
26=10 だからab?0をどう表現するかが入力例からは謎なところも考察ポイントか
https://youtu.be/TUdZT1wIbe8?t=585
'''
import sys
sys.setrecursionlimit(10 ** 6) # 再帰上限の引き上げ
input = sys.stdin.readline
INF = 2 ** 63 - 1
# a - zまでのテーブルを作成
S_TABLE = []
for i in range(26):
S_TABLE.append(chr(ord('a') + i))
N = int(input())
ans = []
while 0 < N:
# Nから1引いて26で割った余りが文字となる
N -= 1
m = int(N%26)
ans.append(S_TABLE[m])
N //= 26
ans.reverse()
print("".join(ans))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment