結果

問題 No.1407 Kindness
ユーザー AEnAEn
提出日時 2022-06-20 18:59:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,960 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-04-21 08:13:15
合計ジャッジ時間 4,304 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 43 ms
52,480 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 44 ms
51,968 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 99 ms
66,432 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 67 ms
62,976 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 94 ms
66,412 KB
権限があれば一括ダウンロードができます

ソースコード

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