結果

問題 No.2246 1333-like Number
コンテスト
ユーザー lam6er
提出日時 2025-04-16 15:59:51
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 510 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 95,340 KB
実行使用メモリ 78,848 KB
最終ジャッジ日時 2026-07-09 14:14:05
合計ジャッジ時間 3,143 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

# Calculate the length L of the ushippoi number
L = 2 + (n - 1) // 36

# Determine the position within the group of length L
pos = (n - 1) % 36 + 1

remaining = pos
a = 1
b = 2

# Find the correct a and b for the given position
for a_candidate in range(1, 9):
    count = 9 - a_candidate
    if remaining <= count:
        b = a_candidate + remaining
        a = a_candidate
        break
    remaining -= count

# Construct the result string
result = str(a) + str(b) * (L - 1)

print(result)
0