結果

問題 No.1238 選抜クラス
ユーザー DaYuanChiDaYuanChi
提出日時 2021-02-05 21:19:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 1,508 ms
コンパイル使用メモリ 165,680 KB
実行使用メモリ 19,832 KB
最終ジャッジ日時 2023-09-15 06:57:12
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,840 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,424 KB
testcase_08 AC 3 ms
4,904 KB
testcase_09 AC 4 ms
7,228 KB
testcase_10 AC 3 ms
4,472 KB
testcase_11 AC 4 ms
7,228 KB
testcase_12 AC 4 ms
5,144 KB
testcase_13 AC 3 ms
4,944 KB
testcase_14 AC 3 ms
5,068 KB
testcase_15 AC 4 ms
7,228 KB
testcase_16 AC 4 ms
7,560 KB
testcase_17 AC 12 ms
19,760 KB
testcase_18 AC 13 ms
19,528 KB
testcase_19 AC 12 ms
19,520 KB
testcase_20 AC 11 ms
19,576 KB
testcase_21 AC 11 ms
19,560 KB
testcase_22 AC 13 ms
19,764 KB
testcase_23 AC 12 ms
19,752 KB
testcase_24 AC 12 ms
19,696 KB
testcase_25 AC 12 ms
19,760 KB
testcase_26 AC 13 ms
19,772 KB
testcase_27 AC 12 ms
19,832 KB
testcase_28 AC 13 ms
19,704 KB
testcase_29 AC 12 ms
19,628 KB
testcase_30 AC 5 ms
9,284 KB
testcase_31 AC 7 ms
13,368 KB
testcase_32 AC 10 ms
17,512 KB
testcase_33 AC 3 ms
4,428 KB
testcase_34 AC 11 ms
17,468 KB
testcase_35 AC 6 ms
11,332 KB
testcase_36 AC 5 ms
7,220 KB
testcase_37 AC 5 ms
9,292 KB
testcase_38 AC 12 ms
19,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll const MOD = 1e9+7;
ll dp[105][21000];

int main(){
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    int A; cin >> A;
    A -= k;
    a[i] = A;
  }
  dp[0][10000] = 1;
  for(int i = 0; i < n; i++){
    for(int j = -10000; j <= 10000; j++){
      dp[i+1][j+10000] = (dp[i][j+10000])%MOD;
      dp[i+1][j+10000] = (dp[i+1][j+10000]+dp[i][j-a[i]+10000])%MOD;
    }
  }
  ll ans = 0;
  for(int i = 0; i <= 10000; i++){
    ans += (dp[n][i+10000])%MOD;
  }
  ans--;
  ans = (ans+MOD)%MOD;
  cout << ans << endl;
  return 0;
}
  
        
  
0