結果

問題 No.616 へんなソート
ユーザー tentententen
提出日時 2020-12-01 08:22:59
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 711 bytes
コンパイル時間 3,240 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 116,280 KB
最終ジャッジ日時 2023-10-11 03:22:37
合計ジャッジ時間 14,643 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
63,340 KB
testcase_01 AC 121 ms
56,168 KB
testcase_02 AC 124 ms
55,956 KB
testcase_03 AC 125 ms
55,916 KB
testcase_04 AC 137 ms
55,724 KB
testcase_05 AC 123 ms
55,528 KB
testcase_06 AC 137 ms
55,872 KB
testcase_07 AC 123 ms
55,808 KB
testcase_08 AC 136 ms
56,176 KB
testcase_09 AC 139 ms
56,012 KB
testcase_10 AC 124 ms
55,864 KB
testcase_11 AC 135 ms
56,140 KB
testcase_12 AC 148 ms
56,120 KB
testcase_13 AC 1,878 ms
71,352 KB
testcase_14 AC 148 ms
55,868 KB
testcase_15 AC 123 ms
56,156 KB
testcase_16 AC 136 ms
56,116 KB
testcase_17 AC 921 ms
64,752 KB
testcase_18 AC 205 ms
56,008 KB
testcase_19 AC 220 ms
58,076 KB
testcase_20 AC 134 ms
55,840 KB
testcase_21 AC 135 ms
55,716 KB
testcase_22 AC 150 ms
54,080 KB
testcase_23 AC 121 ms
56,124 KB
testcase_24 AC 124 ms
55,880 KB
testcase_25 AC 121 ms
55,816 KB
testcase_26 AC 125 ms
56,476 KB
testcase_27 AC 122 ms
55,604 KB
testcase_28 TLE -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int kk = sc.nextInt();
        int[][] dp = new int[n][kk + 1];
        dp[0][0] = 1;
        for (int i = 1; i < n; i++) {
            for (int j = 0; j <= i; j++) {
                for (int k = 0; j + k <= kk; k++) {
                    dp[i][j + k] += dp[i - 1][k];
                    dp[i][j + k] %= MOD;
                }
            }
        }
        int sum = 0;
        for (int x : dp[n - 1]) {
            sum += x;
            sum %= MOD;
        }
        System.out.println(sum);
    }
}
0