結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー c-yan
提出日時 2021-07-31 08:40:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 422 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-16 09:08:20
合計ジャッジ時間 1,845 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

m = 1000000007

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

fac = [1] * 10
for i in range(9):
    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