結果

問題 No.1238 選抜クラス
ユーザー ks2mks2m
提出日時 2020-09-25 21:56:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 651 ms / 2,000 ms
コード長 1,033 bytes
コンパイル時間 3,649 ms
コンパイル使用メモリ 73,380 KB
実行使用メモリ 469,552 KB
最終ジャッジ日時 2023-09-10 15:25:13
合計ジャッジ時間 15,125 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,204 KB
testcase_01 AC 44 ms
49,280 KB
testcase_02 AC 52 ms
54,596 KB
testcase_03 AC 43 ms
49,252 KB
testcase_04 AC 43 ms
49,320 KB
testcase_05 AC 43 ms
49,116 KB
testcase_06 AC 43 ms
49,404 KB
testcase_07 AC 47 ms
51,360 KB
testcase_08 AC 52 ms
54,972 KB
testcase_09 AC 78 ms
60,368 KB
testcase_10 AC 48 ms
52,008 KB
testcase_11 AC 59 ms
58,976 KB
testcase_12 AC 53 ms
54,472 KB
testcase_13 AC 53 ms
54,464 KB
testcase_14 AC 51 ms
54,452 KB
testcase_15 AC 78 ms
60,648 KB
testcase_16 AC 76 ms
60,440 KB
testcase_17 AC 651 ms
468,784 KB
testcase_18 AC 617 ms
469,224 KB
testcase_19 AC 633 ms
469,424 KB
testcase_20 AC 601 ms
469,324 KB
testcase_21 AC 577 ms
467,120 KB
testcase_22 AC 645 ms
467,260 KB
testcase_23 AC 645 ms
468,968 KB
testcase_24 AC 642 ms
468,996 KB
testcase_25 AC 642 ms
469,352 KB
testcase_26 AC 646 ms
468,948 KB
testcase_27 AC 647 ms
469,264 KB
testcase_28 AC 650 ms
469,160 KB
testcase_29 AC 624 ms
469,552 KB
testcase_30 AC 120 ms
88,188 KB
testcase_31 AC 212 ms
192,600 KB
testcase_32 AC 400 ms
370,452 KB
testcase_33 AC 47 ms
51,112 KB
testcase_34 AC 452 ms
370,876 KB
testcase_35 AC 141 ms
115,388 KB
testcase_36 AC 72 ms
64,644 KB
testcase_37 AC 122 ms
92,756 KB
testcase_38 AC 601 ms
469,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int mod = 1000000007;
		int[][][] dp = new int[n + 1][n + 1][10001];
		dp[0][0][0] = 1;
		for (int i = 0; i < n; i++) {
			int i1 = i + 1;
			for (int j = 0; j <= i; j++) {
				for (int j2 = 0; j2 <= 100 * i; j2++) {
					dp[i1][j][j2] += dp[i][j][j2];
					dp[i1][j][j2] %= mod;
					dp[i1][j + 1][j2 + a[i]] += dp[i][j][j2];
					dp[i1][j + 1][j2 + a[i]] %= mod;
				}
			}
		}

		long ans = 0;
		for (int j = 1; j <= n; j++) {
			for (int j2 = j * k; j2 <= 10000; j2++) {
				ans += dp[n][j][j2];
			}
		}
		ans %= mod;
		System.out.println(ans);
	}
}
0