結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 35 ms
11,264 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 32 ms
10,880 KB
testcase_07 AC 37 ms
11,520 KB
testcase_08 AC 38 ms
11,520 KB
testcase_09 AC 38 ms
11,648 KB
testcase_10 AC 36 ms
11,520 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=[ai*cmb(N-1,i) for i,ai in enumerate([*map(int,input().split())])]
print(int(sum(a)%1000000007))
0