結果

問題 No.1407 Kindness
ユーザー 👑 KazunKazun
提出日時 2021-02-26 22:00:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 428 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 85,408 KB
最終ジャッジ日時 2024-04-10 12:42:09
合計ジャッジ時間 2,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,320 KB
testcase_01 AC 33 ms
52,240 KB
testcase_02 AC 31 ms
52,224 KB
testcase_03 AC 29 ms
52,200 KB
testcase_04 AC 31 ms
53,076 KB
testcase_05 AC 31 ms
52,456 KB
testcase_06 AC 31 ms
53,224 KB
testcase_07 AC 32 ms
52,400 KB
testcase_08 AC 32 ms
52,332 KB
testcase_09 AC 34 ms
53,188 KB
testcase_10 AC 34 ms
53,112 KB
testcase_11 AC 32 ms
52,180 KB
testcase_12 AC 58 ms
84,132 KB
testcase_13 AC 41 ms
64,352 KB
testcase_14 AC 46 ms
66,640 KB
testcase_15 AC 46 ms
74,908 KB
testcase_16 AC 44 ms
70,004 KB
testcase_17 AC 42 ms
68,016 KB
testcase_18 AC 42 ms
67,340 KB
testcase_19 AC 44 ms
73,632 KB
testcase_20 AC 45 ms
72,844 KB
testcase_21 AC 40 ms
62,948 KB
testcase_22 AC 41 ms
62,676 KB
testcase_23 AC 43 ms
71,356 KB
testcase_24 AC 60 ms
85,224 KB
testcase_25 AC 43 ms
67,380 KB
testcase_26 AC 44 ms
70,216 KB
testcase_27 AC 39 ms
62,404 KB
testcase_28 AC 46 ms
74,644 KB
testcase_29 AC 39 ms
62,956 KB
testcase_30 AC 59 ms
84,416 KB
testcase_31 AC 41 ms
65,488 KB
testcase_32 AC 44 ms
73,920 KB
testcase_33 AC 42 ms
64,920 KB
testcase_34 AC 42 ms
71,060 KB
testcase_35 AC 40 ms
64,296 KB
testcase_36 AC 40 ms
61,672 KB
testcase_37 AC 59 ms
85,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=input()

Mod=10**9+7

X=[0]*(10)
X[0]=0
for i in range(1,10):
    X[i]=X[i-1]+i

DP=[[0,0] for _ in range(len(N))]

n=int(N[0])
DP[0][0]=X[n]
DP[0][1]=X[n-1]

for i,r in enumerate(N[1:],1):
    D=DP[i]
    E=DP[i-1]
    r=int(r)

    if r!=0:
        D[0]=((E[0]+1)*X[r  ]+(E[1]+1)*(X[9]-X[r]))%Mod
        D[1]=((E[0]+1)*X[r-1]+(E[1]+1)*(X[9]-X[r-1]))%Mod
    else:
        D[0]=D[1]=(E[1]+1)*(X[9]-X[0])%Mod
print(DP[-1][0])
0