結果

問題 No.1489 Repeat Cumulative Sum
ユーザー ytqm3ytqm3
提出日時 2021-04-05 16:48:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 449 bytes
コンパイル時間 5,522 ms
コンパイル使用メモリ 259,540 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 07:38:35
合計ジャッジ時間 6,881 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 71 ms
4,380 KB
testcase_04 AC 62 ms
4,376 KB
testcase_05 AC 68 ms
4,380 KB
testcase_06 AC 59 ms
4,376 KB
testcase_07 AC 37 ms
4,380 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 76 ms
4,376 KB
testcase_10 AC 68 ms
4,376 KB
testcase_11 AC 52 ms
4,376 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,380 KB
testcase_16 AC 43 ms
4,380 KB
testcase_17 AC 46 ms
4,376 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 23 ms
4,376 KB
testcase_20 AC 30 ms
4,376 KB
testcase_21 AC 58 ms
4,376 KB
testcase_22 AC 6 ms
4,376 KB
testcase_23 AC 16 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 11 ms
4,376 KB
testcase_26 AC 93 ms
4,380 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;
  N--;
  vector<long> A(N);
  for(int i=0;i<N;i++)
  {cin>>A[i];}
  long COM=1;
  for(int i=1;i<=N;i++)
  {COM=COM*((N+M-1-i+1)%mod)%mod;COM=COM*inv_mod(i,mod)%mod;}
  for(int i=0;i<N;i++)
  {ans=(ans+A[i]*COM%mod)%mod;COM=COM*(N-i)%mod*inv_mod((N-i)+M-1,mod)%mod;}
  cout<<ans<<endl;
}
0