結果

問題 No.1407 Kindness
ユーザー anagohirameanagohirame
提出日時 2021-02-26 21:46:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 85,416 KB
最終ジャッジ日時 2024-04-10 12:23:20
合計ジャッジ時間 4,725 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,828 KB
testcase_01 AC 37 ms
52,476 KB
testcase_02 AC 38 ms
52,348 KB
testcase_03 AC 38 ms
52,588 KB
testcase_04 AC 37 ms
53,408 KB
testcase_05 AC 38 ms
53,844 KB
testcase_06 AC 37 ms
52,088 KB
testcase_07 AC 38 ms
53,364 KB
testcase_08 AC 37 ms
52,692 KB
testcase_09 AC 37 ms
53,760 KB
testcase_10 AC 38 ms
52,280 KB
testcase_11 AC 37 ms
53,208 KB
testcase_12 AC 144 ms
84,356 KB
testcase_13 AC 84 ms
78,240 KB
testcase_14 AC 93 ms
78,564 KB
testcase_15 AC 146 ms
83,748 KB
testcase_16 AC 116 ms
81,368 KB
testcase_17 AC 98 ms
79,408 KB
testcase_18 AC 99 ms
79,448 KB
testcase_19 AC 138 ms
83,168 KB
testcase_20 AC 125 ms
81,872 KB
testcase_21 AC 73 ms
76,804 KB
testcase_22 AC 75 ms
76,784 KB
testcase_23 AC 115 ms
81,740 KB
testcase_24 AC 156 ms
85,232 KB
testcase_25 AC 95 ms
79,204 KB
testcase_26 AC 109 ms
80,772 KB
testcase_27 AC 78 ms
77,024 KB
testcase_28 AC 137 ms
83,544 KB
testcase_29 AC 67 ms
73,280 KB
testcase_30 AC 146 ms
84,408 KB
testcase_31 AC 85 ms
78,716 KB
testcase_32 AC 133 ms
83,040 KB
testcase_33 AC 89 ms
78,744 KB
testcase_34 AC 115 ms
81,448 KB
testcase_35 AC 85 ms
78,280 KB
testcase_36 AC 63 ms
72,524 KB
testcase_37 AC 134 ms
85,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9+7
s = input()
n = len(s)
dp = [[0 for _ in range(2)] for _ in range(n)]
dp[0][0] = int(s[0])
dp[0][1] = sum(x for x in range(1, int(s[0])))
for i in range(1, n):
	dp[i][0] = (dp[i-1][0] * int(s[i])) % MOD
	dp[i][1] = (dp[i-1][0] * sum(x for x in range(1, int(s[i]))) + dp[i-1][1] * 45) % MOD
#print(*dp, sep="\n")
ans = sum(dp[n-1]) % MOD
for i in range(1, n):
	ans += pow(45, i, MOD)
	ans %= MOD
print(ans)
0