結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー c-yanc-yan
提出日時 2021-07-31 08:44:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 15,972 KB
最終ジャッジ日時 2023-10-14 14:32:17
合計ジャッジ時間 2,061 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,796 KB
testcase_01 AC 13 ms
7,828 KB
testcase_02 AC 13 ms
7,824 KB
testcase_03 AC 13 ms
7,800 KB
testcase_04 AC 68 ms
11,156 KB
testcase_05 AC 26 ms
8,792 KB
testcase_06 AC 31 ms
9,128 KB
testcase_07 AC 93 ms
12,748 KB
testcase_08 AC 73 ms
11,344 KB
testcase_09 AC 88 ms
12,184 KB
testcase_10 AC 74 ms
11,748 KB
testcase_11 AC 55 ms
10,460 KB
testcase_12 AC 79 ms
11,816 KB
testcase_13 AC 87 ms
12,020 KB
testcase_14 AC 57 ms
10,688 KB
testcase_15 AC 87 ms
12,220 KB
testcase_16 AC 82 ms
11,952 KB
testcase_17 AC 151 ms
15,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

m = 1000000007

N, *c = map(int, open(0).read().split())

fac = [1] * (N + 1)
for i in range(N):
    fac[i + 1] = fac[i] * (i + 1)
    fac[i + 1] %= m

x = 1
for i in range(N - 1):
    x *= i + 1
    x %= m
x *= (pow(10, N, m) + (m - 1)) % m * pow(9, -1, m) % m

result = 0
for i in range(9):
    result += c[i] * (i + 1) * x
    result %= m
for i in range(9):
    result *= pow(fac[c[i]], -1, m)
    result %= m
print(result)
0