結果

問題 No.1407 Kindness
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-02-26 22:16:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 72,576 KB
最終ジャッジ日時 2024-04-10 13:01:46
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
52,608 KB
testcase_01 AC 31 ms
51,840 KB
testcase_02 AC 31 ms
52,096 KB
testcase_03 AC 33 ms
52,480 KB
testcase_04 AC 33 ms
51,840 KB
testcase_05 AC 32 ms
52,000 KB
testcase_06 AC 31 ms
51,968 KB
testcase_07 AC 31 ms
51,840 KB
testcase_08 AC 31 ms
52,608 KB
testcase_09 AC 32 ms
52,096 KB
testcase_10 AC 30 ms
52,224 KB
testcase_11 AC 34 ms
52,480 KB
testcase_12 AC 45 ms
71,680 KB
testcase_13 AC 40 ms
63,232 KB
testcase_14 AC 40 ms
63,616 KB
testcase_15 AC 43 ms
70,400 KB
testcase_16 AC 41 ms
66,560 KB
testcase_17 AC 41 ms
64,640 KB
testcase_18 AC 41 ms
64,896 KB
testcase_19 AC 43 ms
69,888 KB
testcase_20 AC 44 ms
68,004 KB
testcase_21 AC 40 ms
61,568 KB
testcase_22 AC 41 ms
61,824 KB
testcase_23 AC 42 ms
67,968 KB
testcase_24 AC 46 ms
72,320 KB
testcase_25 AC 42 ms
64,512 KB
testcase_26 AC 41 ms
66,176 KB
testcase_27 AC 38 ms
61,184 KB
testcase_28 AC 45 ms
70,528 KB
testcase_29 AC 40 ms
60,672 KB
testcase_30 AC 49 ms
71,552 KB
testcase_31 AC 41 ms
62,848 KB
testcase_32 AC 44 ms
69,760 KB
testcase_33 AC 41 ms
63,744 KB
testcase_34 AC 42 ms
67,072 KB
testcase_35 AC 42 ms
63,488 KB
testcase_36 AC 40 ms
60,928 KB
testcase_37 AC 46 ms
72,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()

mod = 10**9+7

dp = [[0]*2 for i in range(len(n))]
dp[0][0] = int(n[0])
dp[0][1] = (int(n[0])*(int(n[0])-1)//2+1)
for i in range(1,len(n)):
    s = int(n[i])
    dp[i][0] = dp[i-1][0]*s%mod
    dp[i][1] += (dp[i-1][1]*45+1)%mod
    dp[i][1] += s*(s-1)//2*dp[i-1][0]%mod
    dp[i][1] %= mod
print((sum(dp[-1])-1)%mod)
0