結果
| 問題 |
No.327 アルファベット列
|
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-04-06 00:09:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 807 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-06-26 10:41:20 |
| 合計ジャッジ時間 | 3,394 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
# -*- coding: utf-8 -*-
"""
No.327 アルファベット列
https://yukicoder.me/problems/no/327
"""
import sys
from sys import stdin
from itertools import accumulate
from bisect import bisect_right
input = stdin.readline
def solve(N):
lut = [0]
for i in range(1, 10):
lut.append(26**i)
acc = list(accumulate(lut))
# print(acc)
keta = bisect_right(acc, N)
offset = N - acc[keta - 1]
digits = []
for _ in range(keta):
digits.append(offset % 26)
offset //= 26
alp = ['A' for _ in range(keta)]
ans = []
for a, d in zip(alp, digits):
ans.append(chr(ord(a) + d))
ans.reverse()
return ans
def main(args):
N = int(input())
ans = solve(N)
print(*ans, sep='')
if __name__ == '__main__':
main(sys.argv[1:])
kichirb3