結果

問題 No.351 市松スライドパズル
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-05-11 16:22:11
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 1,171 bytes
コンパイル時間 3,989 ms
コンパイル使用メモリ 77,860 KB
実行使用メモリ 512,268 KB
最終ジャッジ日時 2024-04-15 15:10:13
合計ジャッジ時間 13,862 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,552 ms
140,924 KB
testcase_01 AC 148 ms
53,736 KB
testcase_02 AC 141 ms
53,952 KB
testcase_03 AC 140 ms
54,096 KB
testcase_04 AC 143 ms
54,044 KB
testcase_05 AC 146 ms
54,024 KB
testcase_06 AC 143 ms
53,904 KB
testcase_07 AC 148 ms
53,772 KB
testcase_08 AC 143 ms
53,804 KB
testcase_09 AC 144 ms
54,104 KB
testcase_10 AC 147 ms
54,032 KB
testcase_11 AC 156 ms
54,152 KB
testcase_12 AC 153 ms
54,268 KB
testcase_13 MLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No351 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int H = sc.nextInt();//受け取り開始
	int W = sc.nextInt();
	int N = sc.nextInt();
	String[] S = new String[N+1];
	for(int i = 0; i < S.length; i++){
		S[i] = sc.nextLine();
	}//受け取り終了
	int[][] B = new int[H][W];//ブロック作成開始
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(i%2 == 0){
				if(j%2 == 0){
					B[i][j] = 1;
				}
			}else if(i%2 == 1){
				if(j%2 == 1){
					B[i][j] = 1;
				}
			}
		}
	}//ブロック作成終了
	for(int i = 1; i < S.length; i++){
		char c = S[i].charAt(0);
		String SNum = S[i].substring(2, 3);
		int num = Integer.parseInt(SNum);
		switch(c){
		case 'R':
			int tmp = B[num][W-1];
			for(int j = W - 1; j >= 1; j--){
				B[num][j] = B[num][j - 1];
			}
			B[num][0] = tmp;
			break;
		case 'C':
			int tmp2 = B[H-1][num];
			for(int j = H - 1; j >= 1; j--){
				B[j][num] = B[j - 1][num];
			}
			B[0][num] = tmp2;
		}
	}
	String Output;
	if(B[0][0]==1){
		Output = "white";
	}else{
		Output = "black";
	}
	System.out.println(Output);
}	
}
0