結果

問題 No.351 市松スライドパズル
ユーザー YamaKasaYamaKasa
提出日時 2018-09-17 15:05:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 738 bytes
コンパイル時間 3,124 ms
コンパイル使用メモリ 78,920 KB
実行使用メモリ 151,408 KB
最終ジャッジ日時 2023-09-25 09:23:01
合計ジャッジ時間 26,319 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,873 ms
150,068 KB
testcase_01 AC 122 ms
56,080 KB
testcase_02 AC 121 ms
55,660 KB
testcase_03 AC 122 ms
55,948 KB
testcase_04 AC 122 ms
55,920 KB
testcase_05 AC 122 ms
55,996 KB
testcase_06 AC 123 ms
55,888 KB
testcase_07 WA -
testcase_08 AC 122 ms
55,764 KB
testcase_09 AC 128 ms
55,880 KB
testcase_10 WA -
testcase_11 AC 139 ms
55,480 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int H = scan.nextInt();
		int W = scan.nextInt();
		int N = scan.nextInt();
		String []S = new String[N];
		int []K = new int[N];
		for(int i = 0; i < N; i++) {
			S[i] = scan.next();
			K[i] = scan.nextInt();
		}
		scan.close();
		int r = 0;
		int c = 0;
		for(int i = N - 1; i >= 0; i--) {
			if(S[i].equals("R") && r == K[i]) {
				if(c == 0) {
					c = W - 1;
				}else {
					c = c - 1;
				}
			}else if(c == K[i]) {
				if(r == 0) {
					r = H - 1;
				}else {
					r = r - 1;
				}
			}
		}
		if((r + c) % 2 == 0) {
			System.out.println("white");
		}else {
			System.out.println("black");
		}
	}
}
0