結果

問題 No.287 場合の数
ユーザー ぴろずぴろず
提出日時 2015-10-09 22:35:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 3,584 ms
コンパイル使用メモリ 73,684 KB
実行使用メモリ 41,640 KB
最終ジャッジ日時 2024-04-25 12:26:54
合計ジャッジ時間 5,627 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,640 KB
testcase_01 AC 113 ms
41,372 KB
testcase_02 AC 103 ms
40,156 KB
testcase_03 AC 124 ms
41,388 KB
testcase_04 AC 135 ms
41,400 KB
testcase_05 AC 128 ms
41,020 KB
testcase_06 AC 113 ms
41,276 KB
testcase_07 AC 120 ms
41,520 KB
testcase_08 AC 112 ms
40,368 KB
testcase_09 AC 129 ms
41,136 KB
testcase_10 AC 115 ms
40,472 KB
testcase_11 AC 123 ms
41,352 KB
testcase_12 AC 116 ms
40,788 KB
testcase_13 AC 111 ms
41,144 KB
testcase_14 AC 110 ms
40,544 KB
testcase_15 AC 119 ms
41,260 KB
testcase_16 AC 126 ms
41,344 KB
testcase_17 AC 114 ms
40,576 KB
testcase_18 AC 111 ms
40,408 KB
testcase_19 AC 105 ms
40,356 KB
testcase_20 AC 110 ms
40,336 KB
testcase_21 AC 121 ms
41,352 KB
testcase_22 AC 112 ms
40,576 KB
testcase_23 AC 121 ms
41,520 KB
testcase_24 AC 110 ms
40,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no287;

import java.util.Scanner;

public class Main {
	public static final int N = 8;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = x * 6;
		long[] dp = new long[y+1];
		dp[0] = 1;
		for(int i=0;i<N;i++) {
			long[] next = new long[y+1];
			for(int j=0;j<=y;j++) {
				for(int k=0;k<=x;k++) {
					if (j + k <= y) {
						next[j+k] += dp[j];
					}
				}
			}

			dp = next;
		}
		System.out.println(dp[y]);
	}

}
0