結果

問題 No.616 へんなソート
ユーザー htensaihtensai
提出日時 2020-02-12 08:52:32
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 759 bytes
コンパイル時間 1,790 ms
コンパイル使用メモリ 77,564 KB
実行使用メモリ 118,908 KB
最終ジャッジ日時 2024-04-10 11:08:05
合計ジャッジ時間 13,346 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
60,512 KB
testcase_01 AC 104 ms
52,740 KB
testcase_02 AC 109 ms
53,480 KB
testcase_03 AC 119 ms
54,088 KB
testcase_04 AC 125 ms
53,592 KB
testcase_05 AC 120 ms
53,848 KB
testcase_06 AC 124 ms
53,396 KB
testcase_07 AC 119 ms
54,060 KB
testcase_08 AC 138 ms
54,420 KB
testcase_09 AC 127 ms
53,628 KB
testcase_10 AC 118 ms
54,008 KB
testcase_11 AC 118 ms
53,504 KB
testcase_12 AC 147 ms
54,080 KB
testcase_13 AC 1,740 ms
84,064 KB
testcase_14 AC 139 ms
54,104 KB
testcase_15 AC 118 ms
54,116 KB
testcase_16 AC 118 ms
53,452 KB
testcase_17 AC 1,485 ms
75,872 KB
testcase_18 AC 552 ms
62,864 KB
testcase_19 AC 410 ms
63,512 KB
testcase_20 AC 134 ms
54,284 KB
testcase_21 AC 134 ms
54,344 KB
testcase_22 AC 237 ms
58,836 KB
testcase_23 AC 115 ms
54,016 KB
testcase_24 AC 111 ms
54,056 KB
testcase_25 AC 105 ms
52,820 KB
testcase_26 AC 216 ms
58,884 KB
testcase_27 AC 190 ms
56,308 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 + 1][n * (n + 1) / 2 + 1];
        dp[1][0] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 0; j <= i * (i - 1) / 2; j++) {
                for (int k = 0; k < i; k++) {
                    dp[i][j + k] += dp[i - 1][j];
                    dp[i][j + k] %= MOD;
                }
            }
        }
        long total = 0;
        for (int i = 0; i <= kk; i++) {
            total += dp[n][i];
            total %= MOD;
        }
        System.out.println(total);
    }
}
0