結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー ayaoniayaoni
提出日時 2021-07-30 20:42:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 885 bytes
コンパイル時間 2,797 ms
コンパイル使用メモリ 86,400 KB
実行使用メモリ 89,908 KB
最終ジャッジ日時 2023-10-14 02:58:50
合計ジャッジ時間 3,104 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
89,424 KB
testcase_01 AC 85 ms
89,572 KB
testcase_02 AC 87 ms
89,628 KB
testcase_03 AC 89 ms
89,624 KB
testcase_04 AC 90 ms
89,840 KB
testcase_05 AC 92 ms
89,764 KB
testcase_06 AC 91 ms
89,696 KB
testcase_07 AC 92 ms
89,700 KB
testcase_08 AC 92 ms
89,704 KB
testcase_09 AC 92 ms
89,712 KB
testcase_10 AC 93 ms
89,712 KB
testcase_11 AC 92 ms
89,872 KB
testcase_12 AC 86 ms
89,712 KB
testcase_13 AC 89 ms
89,908 KB
testcase_14 AC 91 ms
89,712 KB
testcase_15 AC 89 ms
89,728 KB
testcase_16 AC 90 ms
89,844 KB
testcase_17 AC 91 ms
89,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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):
    c = C[i]
    b = a * c % mod * inv_N % mod
    ans += b % mod * i % mod
    ans %= mod

x = 0
for _ in range(N):
    x *= 10
    x += 1
    x %= mod

ans *= x
ans %= mod
print(ans)
0