結果

問題 No.1407 Kindness
ユーザー ygd.ygd.
提出日時 2021-02-26 21:50:16
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 454 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,148 KB
実行使用メモリ 66,824 KB
最終ジャッジ日時 2024-10-02 14:29:54
合計ジャッジ時間 3,226 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 RE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
L = list(str(N))
L = [int(x) for x in L]
#print(L)
M = len(str(N))
MOD = pow(10,9)+7

A = 45
ans = 0
for i in range(1,M):
    ans += pow(A,i,MOD)
exact = 1
for i in range(M):
    keta = M - i
    shita = (L[i]-1)*L[i]//2
    #print(shita,keta)
    if i != M-1:
        ans += exact*shita* pow(A,keta-1,MOD)
        exact = exact*L[i]%MOD
    else:
        exact = exact*(1+L[i])*L[i]//2%MOD
#print(ans,exact)
ans += exact

print(ans%MOD)
0