結果

問題 No.3548 SigMax Digits (Construction ver.)
コンテスト
ユーザー K2
提出日時 2026-05-22 23:42:34
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 373 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 82,816 KB
最終ジャッジ日時 2026-05-22 23:42:47
合計ジャッジ時間 2,783 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# 自明じゃん!!!!!

M = 1000

table = [0]

for i in range(1, M + 1):
    table.append(table[-1] + max(map(int, str(i))))

memo = {}

for l in range(1, M + 1):
    for r in range(l, M + 1):
        memo[table[r] - table[l - 1]] = (l, r)

BIG = int("8" * 17)

def solve():
    N = int(input())
    if N in memo:
        print(*memo[N])
    else:
        assert N >= 72
        m = (9 - N) % 9
        k = N // 9
        print(BIG - m, BIG + k - 1)
        assert BIG + k - 1 <= 10 ** 18


T = int(input())
for _ in range(T):
    solve()
0