結果

問題 No.189 SUPER HAPPY DAY
ユーザー e-mone-mon
提出日時 2015-04-23 11:53:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,023 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 86,696 KB
実行使用メモリ 105,060 KB
最終ジャッジ日時 2023-09-18 08:34:57
合計ジャッジ時間 8,586 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 239 ms
103,456 KB
testcase_01 WA -
testcase_02 AC 239 ms
103,712 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

M,D = map(int,input().split())
length = 200
dp = [[False for i in range(1800)] for j in range(length)]
dp[0][0] = 1
for i in range(1,10):
    dp[0][i] = 1
for n in range(1,length):
    dp[n] = dp[n-1]+[]
    for i in range(1,10):
        for d in range(1800)[::-1]:
            if d+i < 1800 and dp[n-1][d] is not False: 
                dp[n][d+i] += dp[n-1][d]

M_count = [0 for i in range(1800)]
for digit,i in list(enumerate(list(str(M))[::-1]))[::-1]:
    if digit == 0:
        for j in range(1,int(i)+1):
            M_count[j] = 1
        break
    for j in range(1,1800):
        M_count[j] += dp[digit-1][j] * int(i)

D_count = [0 for i in range(1800)]
for digit,i in list(enumerate(list(str(D))[::-1]))[::-1]:
    if digit == 0:
        for j in range(1,int(i)+1):
            D_count[j] = 1
        break
    for j in range(1800):
        D_count[j] += dp[digit-1][j] * int(i)

ans = 0
for i in range(1800):
    ans += M_count[i] * D_count[i]
print(ans%(10**9+9))
0