結果

問題 No.1407 Kindness
ユーザー H3PO4H3PO4
提出日時 2021-02-26 21:57:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-10 12:38:01
合計ジャッジ時間 5,061 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,624 KB
testcase_01 AC 24 ms
10,624 KB
testcase_02 AC 23 ms
10,624 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 26 ms
10,624 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 24 ms
10,752 KB
testcase_07 AC 23 ms
10,752 KB
testcase_08 AC 23 ms
10,624 KB
testcase_09 AC 23 ms
10,752 KB
testcase_10 AC 23 ms
10,624 KB
testcase_11 AC 24 ms
10,624 KB
testcase_12 AC 254 ms
11,008 KB
testcase_13 AC 71 ms
10,624 KB
testcase_14 AC 87 ms
10,624 KB
testcase_15 AC 232 ms
10,752 KB
testcase_16 AC 151 ms
10,752 KB
testcase_17 AC 107 ms
10,752 KB
testcase_18 AC 102 ms
10,624 KB
testcase_19 AC 214 ms
10,880 KB
testcase_20 AC 181 ms
10,880 KB
testcase_21 AC 34 ms
10,752 KB
testcase_22 AC 40 ms
10,624 KB
testcase_23 AC 172 ms
10,752 KB
testcase_24 AC 279 ms
10,880 KB
testcase_25 AC 102 ms
10,752 KB
testcase_26 AC 140 ms
10,880 KB
testcase_27 AC 37 ms
10,624 KB
testcase_28 AC 229 ms
10,880 KB
testcase_29 AC 31 ms
10,624 KB
testcase_30 AC 253 ms
11,008 KB
testcase_31 AC 72 ms
10,752 KB
testcase_32 AC 242 ms
10,752 KB
testcase_33 AC 100 ms
10,624 KB
testcase_34 AC 184 ms
10,752 KB
testcase_35 AC 84 ms
10,752 KB
testcase_36 AC 30 ms
10,752 KB
testcase_37 AC 282 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
modinv = lambda a, mod=MOD: pow(a, -1, mod)

N = input()

L = len(N)
ans = 45 * (pow(45, L - 1, MOD) - 1) * modinv(44) % MOD
tmp = 1
for i, n in enumerate(N, 1):
    n = int(n)
    ans += tmp * n * (n - 1) // 2 * pow(45, L - i, MOD)
    ans %= MOD
    tmp *= n
    tmp %= MOD
ans += tmp
ans %= MOD
print(ans)
0