結果

問題 No.287 場合の数
ユーザー hiromi_ayasehiromi_ayase
提出日時 2015-10-10 03:20:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 3,599 ms
コンパイル使用メモリ 72,324 KB
実行使用メモリ 56,232 KB
最終ジャッジ日時 2023-08-07 18:58:34
合計ジャッジ時間 7,914 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,716 KB
testcase_01 AC 122 ms
55,988 KB
testcase_02 AC 122 ms
55,864 KB
testcase_03 AC 129 ms
55,892 KB
testcase_04 AC 131 ms
55,760 KB
testcase_05 AC 129 ms
55,984 KB
testcase_06 AC 124 ms
55,996 KB
testcase_07 AC 131 ms
56,164 KB
testcase_08 AC 129 ms
55,792 KB
testcase_09 AC 131 ms
55,764 KB
testcase_10 AC 133 ms
56,136 KB
testcase_11 AC 129 ms
55,644 KB
testcase_12 AC 136 ms
56,092 KB
testcase_13 AC 124 ms
56,068 KB
testcase_14 AC 129 ms
55,972 KB
testcase_15 AC 129 ms
55,820 KB
testcase_16 AC 129 ms
56,172 KB
testcase_17 AC 134 ms
56,232 KB
testcase_18 AC 129 ms
56,228 KB
testcase_19 AC 129 ms
55,972 KB
testcase_20 AC 130 ms
55,820 KB
testcase_21 AC 129 ms
56,148 KB
testcase_22 AC 127 ms
55,852 KB
testcase_23 AC 127 ms
55,808 KB
testcase_24 AC 128 ms
56,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Problem288 {
    public static void main(String[] args) {
        int N = new Scanner(System.in).nextInt();
        System.out.println(dp(N));
    }

    public static long dp(int n) {
        long[][] dp = new long[9][];
        for (int i = 0; i < dp.length; i ++) {
            dp[i] = new long[6 * n + 1];
        }
        dp[0][0] = 1;

        for (int i = 1; i <= 8; i ++){
            for (int j = 0; j <= 6 * n; j ++) {
                for (int k = 0; k <= n; k ++) {
                    if (j >= k)
                        dp[i][j] += dp[i - 1][j - k];
                }
            }
        }
        return dp[8][6 * n];
    }
}
0