結果

問題 No.1407 Kindness
ユーザー 👑 KazunKazun
提出日時 2021-02-26 21:51:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 85,472 KB
最終ジャッジ日時 2024-04-10 12:30:50
合計ジャッジ時間 2,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,736 KB
testcase_01 AC 32 ms
52,892 KB
testcase_02 AC 30 ms
52,128 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 29 ms
52,928 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 43 ms
71,652 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 42 ms
65,524 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 57 ms
85,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=input()

Memo={}
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))]

DP[0][0]=int(N[0])
DP[0][1]=DP[0][0]-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