結果

問題 No.1407 Kindness
ユーザー AEn
提出日時 2022-06-20 18:59:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 76,008 KB
最終ジャッジ日時 2024-10-13 06:59:02
合計ジャッジ時間 4,042 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
sm = [0]*10
mod = 10**9+7
for i in range(1, 10):
    sm[i] = i+sm[i-1]
if len(N) == 1:
    exit(print(sm[int(N)]))
res = 0
ss = 0
for i in range(len(N)):
    if i == 0:
        if int(N[0])>1:
            res += sm[int(N[0])-1]*int(N[i])*pow(45, len(N)-(i+1), mod)
            res %= mod
        ss = int(N[0])
    else:
        res += pow(45, len(N)-i, mod)
        res %= mod
        if int(N[i])>1:
            res += ss*sm[int(N[i])-1]*pow(45, len(N)-(i+1), mod)
            res %= mod
        ss *= int(N[i])
        ss %= mod
res += ss
print(res%mod)
0