結果

問題 No.361 門松ゲーム2
ユーザー rn4rurn4ru
提出日時 2016-04-18 00:40:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 78,116 KB
実行使用メモリ 61,464 KB
最終ジャッジ日時 2024-04-15 03:04:16
合計ジャッジ時間 8,546 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
59,752 KB
testcase_01 AC 139 ms
53,852 KB
testcase_02 AC 138 ms
54,864 KB
testcase_03 AC 136 ms
53,968 KB
testcase_04 AC 139 ms
53,988 KB
testcase_05 AC 138 ms
54,072 KB
testcase_06 WA -
testcase_07 AC 138 ms
54,236 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 236 ms
42,212 KB
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int L = scanner.nextInt();
		int D = scanner.nextInt();
		System.out.println(new Solver().solve(L, D));
	}
}

class Solver {

	public String solve(int l, int d) {
		if (win(l, d)) {
			return "kado";
		}
		return "matsu";
	}

	private boolean win(int l, final int d) {
		for (int i = 1; i < l - 2; i++) {
			for (int j = i + 1; j < l - 1; j++) {
				int k = l - i - j;
				if (i <= 0 || j <= 0 || k <= 0)
					continue;
				if (i == j || i == k || j == k)
					continue;
				if (Math.max(i, Math.max(j, k)) - Math.min(i, Math.min(j, k)) > d)
					continue;

				if (!win(i, d) && !win(j, d) && !win(k, d))
					return true;
			}
		}
		return false;
	}

}
0