結果

問題 No.398 ハーフパイプ(2)
ユーザー 37zigen37zigen
提出日時 2016-07-16 11:14:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 835 ms / 2,000 ms
コード長 1,146 bytes
コンパイル時間 3,099 ms
コンパイル使用メモリ 73,764 KB
実行使用メモリ 187,292 KB
最終ジャッジ日時 2023-09-09 22:09:12
合計ジャッジ時間 19,082 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 835 ms
186,224 KB
testcase_01 AC 828 ms
186,708 KB
testcase_02 AC 823 ms
186,728 KB
testcase_03 AC 826 ms
186,744 KB
testcase_04 AC 826 ms
186,336 KB
testcase_05 AC 829 ms
186,172 KB
testcase_06 AC 826 ms
186,804 KB
testcase_07 AC 826 ms
186,700 KB
testcase_08 AC 831 ms
185,232 KB
testcase_09 AC 828 ms
186,364 KB
testcase_10 AC 828 ms
186,840 KB
testcase_11 AC 835 ms
186,728 KB
testcase_12 AC 835 ms
187,292 KB
testcase_13 AC 830 ms
186,752 KB
testcase_14 AC 828 ms
186,880 KB
testcase_15 AC 826 ms
186,748 KB
testcase_16 AC 826 ms
186,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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=0;j<=100;j++){
				for(int k=0;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