結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー 👑 rin204rin204
提出日時 2022-02-24 19:50:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 3,000 ms
コード長 720 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 78,192 KB
最終ジャッジ日時 2023-09-15 09:30:09
合計ジャッジ時間 6,791 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,480 KB
testcase_01 AC 76 ms
71,332 KB
testcase_02 AC 95 ms
76,620 KB
testcase_03 AC 76 ms
71,336 KB
testcase_04 AC 79 ms
71,352 KB
testcase_05 AC 79 ms
71,456 KB
testcase_06 AC 79 ms
71,224 KB
testcase_07 AC 77 ms
71,240 KB
testcase_08 AC 78 ms
71,332 KB
testcase_09 AC 78 ms
71,352 KB
testcase_10 AC 76 ms
71,408 KB
testcase_11 AC 77 ms
71,352 KB
testcase_12 AC 87 ms
76,320 KB
testcase_13 AC 85 ms
76,256 KB
testcase_14 AC 88 ms
76,268 KB
testcase_15 AC 88 ms
76,856 KB
testcase_16 AC 91 ms
76,672 KB
testcase_17 AC 91 ms
76,864 KB
testcase_18 AC 92 ms
76,708 KB
testcase_19 AC 92 ms
76,628 KB
testcase_20 AC 92 ms
76,776 KB
testcase_21 AC 96 ms
76,864 KB
testcase_22 AC 95 ms
76,824 KB
testcase_23 AC 94 ms
76,668 KB
testcase_24 AC 94 ms
76,876 KB
testcase_25 AC 95 ms
76,656 KB
testcase_26 AC 94 ms
76,728 KB
testcase_27 AC 94 ms
76,700 KB
testcase_28 AC 94 ms
76,700 KB
testcase_29 AC 95 ms
76,500 KB
testcase_30 AC 120 ms
77,988 KB
testcase_31 AC 112 ms
77,608 KB
testcase_32 AC 158 ms
78,192 KB
testcase_33 AC 154 ms
77,960 KB
testcase_34 AC 190 ms
77,708 KB
testcase_35 AC 191 ms
77,684 KB
testcase_36 AC 190 ms
77,768 KB
testcase_37 AC 195 ms
77,908 KB
testcase_38 AC 181 ms
77,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
MOD = 10 ** 9 + 7

N = input()
dp = {}

def f(i):
    if i == 0:
        return 0
    else:
        return gcd(i, 100)

for i in range(1, int(N[0])):
    dp[f(i)] = dp.get(f(i), 0) + 1

same = f(int(N[0]))
for n in N[1:]:
    n = int(n)
    ndp = {}
    for k, v in dp.items():
        for i in range(10):
            ndp[f(k * i)] = ndp.get(f(k * i), 0) + v
            ndp[f(k * i)] %= MOD
    for i in range(n):
        ndp[f(same * i)] = ndp.get(f(same * i), 0) + 1
        ndp[f(same * i)] %= MOD
    for i in range(10):
        ndp[f(i)] = ndp.get(f(i), 0) + 1
        ndp[f(i)] %= MOD
    same = f(same * n)
    dp = ndp
    
ans = dp.get(100, 0)
if same == 100:
    ans += 1
print(ans % MOD)
0