結果

問題 No.361 門松ゲーム2
ユーザー 37zigen37zigen
提出日時 2016-05-28 11:54:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 3,626 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 41,596 KB
最終ジャッジ日時 2024-04-16 18:05:21
合計ジャッジ時間 7,818 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 127 ms
41,220 KB
testcase_02 AC 128 ms
41,176 KB
testcase_03 AC 131 ms
41,064 KB
testcase_04 WA -
testcase_05 AC 127 ms
41,188 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 138 ms
41,168 KB
testcase_09 AC 128 ms
41,064 KB
testcase_10 AC 133 ms
41,596 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 124 ms
40,200 KB
testcase_14 WA -
testcase_15 AC 137 ms
41,336 KB
testcase_16 WA -
testcase_17 AC 140 ms
40,956 KB
testcase_18 AC 141 ms
41,176 KB
testcase_19 WA -
testcase_20 AC 136 ms
41,192 KB
testcase_21 AC 136 ms
41,192 KB
testcase_22 WA -
testcase_23 AC 125 ms
40,152 KB
testcase_24 AC 125 ms
40,632 KB
testcase_25 WA -
testcase_26 AC 149 ms
41,356 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int L=sc.nextInt();
		int D=sc.nextInt();
		boolean[] g=new boolean[L+1];
		//g[i]=長さiの竹のみがあるとき、勝つことができるか。

		for(int len=1;len<=L;len++){
			out:for(int i=1;3*i<len;i++){
				for(int j=i+1;i+2*j<len;j++){
					//k>j,len-i-j>j,len>i+2*j
					int k=len-i-j;
					if(k-i<=D){
						if(g[i]^g[j]^g[k]){
							g[len]=true;
							break out;
						}
					}
				}
			}
		}
		System.out.println(g[L]?"kado":"matsu");
	}
	void tr(Object...o){
		System.out.println(Arrays.deepToString(o));
	}
}
0