結果

問題 No.1407 Kindness
ユーザー marroncastlemarroncastle
提出日時 2021-02-26 22:21:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 82,552 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-04-10 13:06:54
合計ジャッジ時間 3,240 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,096 KB
testcase_01 AC 34 ms
52,096 KB
testcase_02 AC 33 ms
51,712 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 35 ms
52,480 KB
testcase_05 AC 34 ms
51,712 KB
testcase_06 AC 34 ms
52,224 KB
testcase_07 AC 35 ms
51,840 KB
testcase_08 AC 35 ms
51,840 KB
testcase_09 AC 34 ms
52,096 KB
testcase_10 AC 34 ms
52,480 KB
testcase_11 AC 35 ms
52,004 KB
testcase_12 AC 59 ms
75,904 KB
testcase_13 AC 49 ms
65,408 KB
testcase_14 AC 51 ms
67,200 KB
testcase_15 AC 55 ms
74,624 KB
testcase_16 AC 51 ms
69,760 KB
testcase_17 AC 50 ms
67,584 KB
testcase_18 AC 54 ms
68,224 KB
testcase_19 AC 59 ms
73,984 KB
testcase_20 AC 56 ms
71,680 KB
testcase_21 AC 45 ms
63,360 KB
testcase_22 AC 46 ms
63,488 KB
testcase_23 AC 52 ms
71,168 KB
testcase_24 AC 60 ms
77,696 KB
testcase_25 AC 51 ms
67,712 KB
testcase_26 AC 52 ms
69,504 KB
testcase_27 AC 45 ms
62,976 KB
testcase_28 AC 57 ms
74,368 KB
testcase_29 AC 45 ms
61,824 KB
testcase_30 AC 58 ms
75,776 KB
testcase_31 AC 46 ms
65,280 KB
testcase_32 AC 54 ms
73,344 KB
testcase_33 AC 46 ms
65,280 KB
testcase_34 AC 49 ms
69,760 KB
testcase_35 AC 46 ms
64,512 KB
testcase_36 AC 44 ms
61,604 KB
testcase_37 AC 54 ms
75,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9+7
N = list(map(int,list(input())))
n = len(N)
if n==1:
  print(N[0]*(N[0]+1)//2)
  exit()
lis = [1]*n
for i in range(1,n):
  lis[i] = lis[i-1]*45%MOD
dp1 = [0]*n
dp2 = [0]*n
dp3 = [0]*n
dp2[0] = lis[0]*((N[-1]-1)*N[-1]//2)%MOD
for i in range(1,n):
  if N[-i-1]>0:
    dp2[i] = lis[i]*((N[-i-1]-1)*N[-i-1]//2)%MOD
  dp3[i] = dp3[i-1]+lis[i]
dp1[0] = N[-1]
for i in range(1,n):
  if N[-i-1]>0:
    dp1[i] = (dp1[i-1]+dp2[i-1])*N[-i-1]%MOD
print((dp1[-1]+dp2[-1]+dp3[-1])%MOD)
0