結果

問題 No.1489 Repeat Cumulative Sum
コンテスト
ユーザー ytqm3
提出日時 2021-04-03 22:56:40
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 419 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,162 ms
コンパイル使用メモリ 210,012 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2026-06-19 11:37:52
合計ジャッジ時間 4,998 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 1 RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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