結果

問題 No.1238 選抜クラス
ユーザー kk
提出日時 2020-10-27 19:34:58
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 2,711 ms
コンパイル使用メモリ 199,668 KB
実行使用メモリ 7,320 KB
最終ジャッジ日時 2023-09-29 03:21:45
合計ジャッジ時間 7,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 176 ms
7,320 KB
testcase_18 AC 161 ms
7,052 KB
testcase_19 AC 165 ms
7,072 KB
testcase_20 AC 152 ms
7,020 KB
testcase_21 AC 137 ms
6,992 KB
testcase_22 AC 175 ms
7,244 KB
testcase_23 AC 173 ms
7,260 KB
testcase_24 AC 176 ms
7,248 KB
testcase_25 AC 175 ms
7,248 KB
testcase_26 AC 176 ms
7,224 KB
testcase_27 AC 174 ms
7,208 KB
testcase_28 AC 176 ms
7,288 KB
testcase_29 AC 165 ms
7,308 KB
testcase_30 AC 8 ms
4,376 KB
testcase_31 AC 33 ms
4,728 KB
testcase_32 AC 81 ms
5,936 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 110 ms
6,464 KB
testcase_35 AC 13 ms
4,376 KB
testcase_36 AC 3 ms
4,380 KB
testcase_37 AC 8 ms
4,380 KB
testcase_38 AC 152 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);
const int MOD = 1e9 + 7;

int dp[100+1][10000+1];


int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  REP (i, n) cin >> a[i];
  
  dp[0][0] = 1;

  REP (x, n) {
    for (int i = n; i > 0; i--) {
      for (int j = 0; j <= 100 * n; j++) {
        if (j - a[x] >= 0) {
          dp[i][j] += dp[i-1][j-a[x]];
          dp[i][j] %= MOD;
        }
      }
    }
  }

  int ret = 0;
  FOR (i, 1, n+1) REP (j, 100 * n + 1) {
    if (j >= i * k) {
      ret += dp[i][j];
      ret %= MOD;
    }
  }

  cout << ret << endl;
  
  return 0;
}
0