結果
問題 | No.41 貯金箱の溜息(EASY) |
ユーザー | 双六 |
提出日時 | 2020-07-26 15:24:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 721 bytes |
コンパイル時間 | 1,029 ms |
コンパイル使用メモリ | 87,212 KB |
実行使用メモリ | 86,600 KB |
最終ジャッジ日時 | 2023-09-11 01:53:25 |
合計ジャッジ時間 | 1,295 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 140 ms
86,600 KB |
testcase_01 | AC | 141 ms
86,184 KB |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 9; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): T = int(input()) DP = [[0] * (10 ** 5 + 10) for i in range(10)] DP[0][0] = 1 for i in range(9): for j in range(10 ** 5): DP[i][j + (i + 1)] += DP[i][j] DP[i + 1][j] += DP[i][j] DP[i][j + (i + 1)] %= con DP[i + 1][j] %= con # 累積 DPs = [0] * (10 ** 5 + 1) DPs[0] = DP[-1][0] for i in range(1, 10 ** 5 + 1): DPs[i] = (DPs[i - 1] + DP[-1][i]) % con for i in range(T): M = int(input()) M = int(M // 111111) print(DPs[M]) if __name__ == '__main__': main()