結果
| 問題 |
No.1489 Repeat Cumulative Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-05 14:32:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 442 bytes |
| コンパイル時間 | 5,842 ms |
| コンパイル使用メモリ | 250,948 KB |
| 最終ジャッジ日時 | 2025-01-20 11:58:00 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 24 RE * 3 |
ソースコード
#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);
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;
}