結果

問題 No.1081 和の和
ユーザー rythem00359rythem00359
提出日時 2020-08-13 17:19:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 307 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-04-18 01:40:17
合計ジャッジ時間 1,025 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 34 ms
11,392 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 35 ms
11,264 KB
testcase_08 AC 35 ms
11,520 KB
testcase_09 AC 36 ms
11,520 KB
testcase_10 AC 35 ms
11,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

nCr={}
def cmb(n,r):
    if r==0 or r==n: return 1
    if r==1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
N=int(input())
a=[*map(lambda args:args[1]*cmb(N-1,args[0]),enumerate([*map(int,input().split())]))]
print(int(sum(a)%1000000007))
0