結果
| 問題 | No.1629 Sorting Integers (SUM of M) |
| コンテスト | |
| ユーザー |
ayaoni
|
| 提出日時 | 2021-07-30 23:23:19 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 846 bytes |
| 記録 | |
| コンパイル時間 | 255 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 73,088 KB |
| 最終ジャッジ日時 | 2024-09-16 03:30:56 |
| 合計ジャッジ時間 | 2,152 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())
N = I()
C = [0]+LI()
mod = 10**9+7
fac = [1,1]
for i in range(2,2*10**5+1):
fac.append((fac[-1]*i) % mod)
a = fac[N]
for i in range(1,10):
a *= pow(fac[C[i]],mod-2,mod)
a %= mod
inv_N = pow(N,mod-2,mod)
ans = 0
for i in range(1,10):
ans += a * C[i] % mod * inv_N % mod * i % mod
ans %= mod
ans *= pow(10,N,mod)-1
ans %= mod
ans *= pow(9,mod-2,mod)
ans %= mod
print(ans)
ayaoni