結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー convexineqconvexineq
提出日時 2021-03-05 22:16:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 175 ms / 3,000 ms
コード長 830 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 77,936 KB
最終ジャッジ日時 2024-04-16 09:52:01
合計ジャッジ時間 4,564 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,864 KB
testcase_01 AC 41 ms
53,632 KB
testcase_02 AC 71 ms
74,368 KB
testcase_03 AC 36 ms
52,736 KB
testcase_04 AC 37 ms
52,352 KB
testcase_05 AC 38 ms
53,248 KB
testcase_06 AC 36 ms
52,864 KB
testcase_07 AC 37 ms
53,248 KB
testcase_08 AC 36 ms
53,220 KB
testcase_09 AC 37 ms
53,120 KB
testcase_10 AC 38 ms
53,120 KB
testcase_11 AC 36 ms
53,248 KB
testcase_12 AC 57 ms
66,688 KB
testcase_13 AC 50 ms
64,256 KB
testcase_14 AC 56 ms
65,536 KB
testcase_15 AC 76 ms
76,444 KB
testcase_16 AC 79 ms
76,672 KB
testcase_17 AC 79 ms
76,416 KB
testcase_18 AC 77 ms
76,160 KB
testcase_19 AC 87 ms
76,376 KB
testcase_20 AC 80 ms
76,416 KB
testcase_21 AC 93 ms
76,784 KB
testcase_22 AC 99 ms
76,340 KB
testcase_23 AC 95 ms
76,672 KB
testcase_24 AC 76 ms
74,624 KB
testcase_25 AC 97 ms
76,820 KB
testcase_26 AC 96 ms
76,496 KB
testcase_27 AC 91 ms
76,280 KB
testcase_28 AC 80 ms
76,472 KB
testcase_29 AC 83 ms
76,472 KB
testcase_30 AC 123 ms
77,060 KB
testcase_31 AC 93 ms
76,584 KB
testcase_32 AC 166 ms
77,936 KB
testcase_33 AC 141 ms
77,376 KB
testcase_34 AC 174 ms
77,316 KB
testcase_35 AC 175 ms
77,252 KB
testcase_36 AC 174 ms
77,460 KB
testcase_37 AC 165 ms
77,392 KB
testcase_38 AC 125 ms
76,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
T = [0, 0, 1, 0, 2, 0, 1, 0, 2, 0]
F = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
dp = [[[0]*3 for _ in range(3)] for _ in range(2)]
# two , five, less
first = 1
MOD = 10**9+7
for x in map(int,s):
    ndp = [[[0]*3 for _ in range(3)] for _ in range(2)]
    if first:
        first = 0
        for j in range(1,x+1):
            ndp[int(j<x)][T[j]][F[j]] += 1
    else:
        for j in range(1,10):
            ndp[1][T[j]][F[j]] += 1

    for is_less in range(2):
        for two in range(3):
            for five in range(3):
                for j in range(1,10 if is_less else x+1):
                    ndp[is_less|int(j < x)][min(2,two+T[j])][min(2,five+F[j])] += dp[is_less][two][five]
                    ndp[is_less|int(j < x)][min(2,two+T[j])][min(2,five+F[j])] %= MOD

    dp = ndp
print((dp[0][2][2] + dp[1][2][2]) %MOD)
0