結果
問題 | No.1489 Repeat Cumulative Sum |
ユーザー |
|
提出日時 | 2021-04-05 14:34:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 443 bytes |
コンパイル時間 | 3,772 ms |
コンパイル使用メモリ | 251,000 KB |
最終ジャッジ日時 | 2025-01-20 11:58:26 |
ジャッジサーバーID (参考情報) |
judge2 / 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+=A[i]*COM%mod;COM=COM*(N-i)%mod*inv_mod(((N-i)+M-1)%mod,mod)%mod;} cout<<ans%mod<<endl; }