結果

問題 No.287 場合の数
ユーザー hiromi_ayasehiromi_ayase
提出日時 2015-10-10 03:20:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 683 bytes
コンパイル時間 3,444 ms
コンパイル使用メモリ 74,452 KB
実行使用メモリ 41,532 KB
最終ジャッジ日時 2024-04-25 12:31:51
合計ジャッジ時間 6,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
41,136 KB
testcase_01 AC 109 ms
41,096 KB
testcase_02 AC 107 ms
41,096 KB
testcase_03 AC 115 ms
41,460 KB
testcase_04 AC 109 ms
40,348 KB
testcase_05 AC 115 ms
41,100 KB
testcase_06 AC 99 ms
40,276 KB
testcase_07 AC 109 ms
40,756 KB
testcase_08 AC 118 ms
41,220 KB
testcase_09 AC 108 ms
40,468 KB
testcase_10 AC 114 ms
41,328 KB
testcase_11 AC 113 ms
40,004 KB
testcase_12 AC 113 ms
40,600 KB
testcase_13 AC 106 ms
41,344 KB
testcase_14 AC 117 ms
41,108 KB
testcase_15 AC 109 ms
40,252 KB
testcase_16 AC 114 ms
41,468 KB
testcase_17 AC 110 ms
40,468 KB
testcase_18 AC 105 ms
40,472 KB
testcase_19 AC 120 ms
41,232 KB
testcase_20 AC 115 ms
41,088 KB
testcase_21 AC 113 ms
41,532 KB
testcase_22 AC 116 ms
41,112 KB
testcase_23 AC 115 ms
41,260 KB
testcase_24 AC 117 ms
39,988 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