結果

問題 No.398 ハーフパイプ(2)
ユーザー 37zigen37zigen
提出日時 2016-07-16 11:16:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 903 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 73,780 KB
実行使用メモリ 186,956 KB
最終ジャッジ日時 2023-09-09 22:10:58
合計ジャッジ時間 19,354 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 903 ms
185,972 KB
testcase_01 AC 894 ms
186,744 KB
testcase_02 AC 892 ms
186,476 KB
testcase_03 AC 889 ms
186,624 KB
testcase_04 AC 894 ms
186,312 KB
testcase_05 AC 885 ms
186,880 KB
testcase_06 AC 890 ms
186,956 KB
testcase_07 AC 884 ms
186,476 KB
testcase_08 AC 888 ms
186,668 KB
testcase_09 AC 892 ms
186,656 KB
testcase_10 AC 882 ms
186,640 KB
testcase_11 AC 886 ms
186,836 KB
testcase_12 AC 884 ms
186,956 KB
testcase_13 AC 889 ms
186,560 KB
testcase_14 AC 885 ms
186,792 KB
testcase_15 AC 880 ms
186,740 KB
testcase_16 AC 879 ms
186,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package No300台;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solver();
	}

	static void solver() {
		Scanner sc = new Scanner(System.in);
		double X = sc.nextDouble();
		int n = (int) (X * 4);
		long[][][] from = new long[101][101][601];
		long[][][] to = new long[101][101][601];
		from[100][0][0] = 1;
		for (int i = 0; i < 6; i++) {
			for (int x = 0; x <= 100; x++) {
				for (int y = 0; y <= 100; y++) {
					for (int j = 0; j <= 100 * i; j++) {
						if (from[x][y][j] != 0) {
							for (int k = 0; k <= 100; k++) {
								to[Math.min(x, k)][Math.max(y, k)][j + k] += from[x][y][j];
							}
						}
					}
				}
			}
			long[][][] d = to;
			to = from;
			from = d;
			to = init(to);
		}
		long sum = 0;
		for (int i = 0; i <= 100; i++) {
			for (int j = i; j <= 100; j++) {
				for (int k = 6 * i; k <= 600; k++) {
					if (k - (i + j) == n) {
						sum += from[i][j][k];
					}
				}
			}
		}
		System.out.println(sum);
	}

	static long[][][] init(long[][][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				for (int k = 0; k < a[0][0].length; k++) {
					a[i][j][k] = 0;
				}
			}
		}
		return a;
	}
}
0