結果

問題 No.189 SUPER HAPPY DAY
ユーザー titiatitia
提出日時 2022-05-31 06:29:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,255 ms / 5,000 ms
コード長 570 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 31,104 KB
最終ジャッジ日時 2023-12-28 10:30:57
合計ジャッジ時間 30,713 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,112 KB
testcase_01 AC 57 ms
10,240 KB
testcase_02 AC 30 ms
10,112 KB
testcase_03 AC 70 ms
10,368 KB
testcase_04 AC 72 ms
10,368 KB
testcase_05 AC 74 ms
10,368 KB
testcase_06 AC 73 ms
10,368 KB
testcase_07 AC 80 ms
10,368 KB
testcase_08 AC 72 ms
10,368 KB
testcase_09 AC 77 ms
10,368 KB
testcase_10 AC 79 ms
10,368 KB
testcase_11 AC 77 ms
10,368 KB
testcase_12 AC 76 ms
10,368 KB
testcase_13 AC 1,849 ms
21,632 KB
testcase_14 AC 2,441 ms
25,600 KB
testcase_15 AC 2,390 ms
25,472 KB
testcase_16 AC 2,726 ms
27,648 KB
testcase_17 AC 2,934 ms
28,928 KB
testcase_18 AC 2,286 ms
24,704 KB
testcase_19 AC 3,255 ms
31,104 KB
testcase_20 AC 1,046 ms
16,640 KB
testcase_21 AC 1,113 ms
16,768 KB
testcase_22 AC 220 ms
11,264 KB
testcase_23 AC 2,707 ms
27,776 KB
testcase_24 AC 2,704 ms
27,776 KB
testcase_25 AC 2,716 ms
27,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M,D=map(int,input().split())

mod=10**9+9


ANS=[0]*2000
    
from functools import lru_cache
@lru_cache(maxsize=None)
def calc(X):
    ANS=[0]*2000
    if X<=9:
        for i in range(X+1):
            ANS[i]=1
        return ANS

    for i in range(10):
        if X>=i:
            x=(X-i)//10

            for j in range(2000):
                if calc(x)[j]!=0:
                    ANS[j+i]+=calc(x)[j]
                    ANS[j+i]%=mod
    return ANS

ANS=calc(M)
ANS2=calc(D)

score=0

for i in range(1,2000):
    score+=ANS[i]*ANS2[i]
    score%=mod

print(score)
0