結果

問題 No.1489 Repeat Cumulative Sum
ユーザー ytqm3ytqm3
提出日時 2021-04-13 21:59:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 446 bytes
コンパイル時間 4,188 ms
コンパイル使用メモリ 260,184 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-17 07:39:33
合計ジャッジ時間 7,018 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 70 ms
4,384 KB
testcase_04 AC 62 ms
4,376 KB
testcase_05 AC 68 ms
4,380 KB
testcase_06 AC 59 ms
4,384 KB
testcase_07 AC 36 ms
4,380 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 77 ms
4,380 KB
testcase_10 AC 67 ms
4,380 KB
testcase_11 AC 53 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 50 ms
4,380 KB
testcase_14 AC 81 ms
4,376 KB
testcase_15 AC 79 ms
4,376 KB
testcase_16 AC 43 ms
4,376 KB
testcase_17 AC 46 ms
4,380 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 23 ms
4,380 KB
testcase_20 AC 31 ms
4,376 KB
testcase_21 AC 58 ms
4,376 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 16 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 11 ms
4,376 KB
testcase_26 AC 92 ms
4,376 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
const int mod=1000000007;

int main()
{
  long N,M,ans=0;
  cin>>N>>M;
  vector<long> A(N+1);
  for(int i=2;i<=N;i++)
  {cin>>A[i];}
  long COM=1;
  for(int i=1;i<=N-1;i++)
  {COM=COM*((N+M-2-i+1)%mod)%mod;COM=COM*inv_mod(i,mod)%mod;}
  for(int k=2;k<=N;k++)
  {ans=(ans+A[k]*COM%mod)%mod;COM=COM*(N-k+1)%mod*inv_mod(N-k+M,mod)%mod;}
  cout<<ans<<endl;
}
0