結果

問題 No.1489 Repeat Cumulative Sum
ユーザー ytqm3
提出日時 2021-04-03 22:56:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,927 ms
コンパイル使用メモリ 192,228 KB
最終ジャッジ日時 2025-01-20 10:47:51
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 1 TLE * 1 MLE * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
  long N,M,ans=0;
  cin>>N>>M;
  long B[M][N];
  for(int j=0;j<N;j++)
  {cin>>B[0][j];}
  for(int i=1;i<M;i++)
  {B[i][0]=B[0][0];}
  for(int i=1;i<M;i++)
  {
    for(int j=1;j<N;j++)
    {B[i][j]=(B[i-1][j]+B[i][j-1])%mod;}
  }
  for(int i=0;i<M;i++)
  {
    for(int j=0;j<N;j++)
    {ans=(ans+B[i][j])%mod;}
  }
  cout<<ans<<endl;
}
0