結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー ayaoniayaoni
提出日時 2020-12-04 17:38:23
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 899 bytes
コンパイル時間 1,313 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 90,364 KB
最終ジャッジ日時 2023-10-13 07:07:02
合計ジャッジ時間 1,281 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
90,364 KB
testcase_01 AC 114 ms
89,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import accumulate
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


mod = 10**9+9
X = (10**10)//111111
dp = [[0]*(X+1) for i in range(10)]
# dp[i][j] = (1*a1+2*a2+…+i*ai == j の解の個数)
dp[0][0] = 1
for i in range(1,10):
    for j in range(X+1):
        a = dp[i-1][j]
        if j >= i:
            a += dp[i][j-i]
            a %= mod
        dp[i][j] = a

A = dp[-1]
SA = list(accumulate(A))

T = I()
for _ in range(T):
    M = I()
    M //= 111111
    print(SA[M] % mod)
0