結果

問題 No.351 市松スライドパズル
ユーザー TatsuDXTatsuDX
提出日時 2016-10-16 20:54:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,853 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 3,757 ms
コンパイル使用メモリ 77,692 KB
実行使用メモリ 77,676 KB
最終ジャッジ日時 2024-05-02 02:29:47
合計ジャッジ時間 26,749 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,647 ms
75,672 KB
testcase_01 AC 140 ms
54,016 KB
testcase_02 AC 138 ms
53,792 KB
testcase_03 AC 140 ms
54,060 KB
testcase_04 AC 139 ms
53,668 KB
testcase_05 AC 141 ms
54,100 KB
testcase_06 AC 137 ms
53,716 KB
testcase_07 AC 140 ms
53,880 KB
testcase_08 AC 136 ms
53,952 KB
testcase_09 AC 142 ms
53,864 KB
testcase_10 AC 142 ms
53,604 KB
testcase_11 AC 148 ms
54,296 KB
testcase_12 AC 149 ms
54,052 KB
testcase_13 AC 1,745 ms
75,864 KB
testcase_14 AC 1,718 ms
76,008 KB
testcase_15 AC 1,759 ms
75,812 KB
testcase_16 AC 1,792 ms
69,280 KB
testcase_17 AC 1,853 ms
75,748 KB
testcase_18 AC 1,726 ms
75,944 KB
testcase_19 AC 1,696 ms
69,164 KB
testcase_20 AC 1,802 ms
77,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int h = sc.nextInt(), w = sc.nextInt(), n = sc.nextInt();
		int x = 0, y = 0;
		int[] m = new int[n];
		char[] c = new char[n];
		for(int i = 0; i < n; i++){
			c[i] = sc.next().charAt(0);
			m[i] = sc.nextInt();
		}
		for(int i = n-1; i >= 0; i--){
			if(y == m[i] && c[i] == 'R'){
				x--;
				if(x < 0){
					x += w;
				}
			} else if(x == m[i] && c[i] == 'C'){
				y--;
				if(y < 0){
					y += h;
				}
			}
		}
		if((x + y) % 2 == 0){
			System.out.println("white");
		} else {
			System.out.println("black");
		}
	}
}
0