結果

問題 No.351 市松スライドパズル
ユーザー 37zigen37zigen
提出日時 2016-03-12 04:02:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,631 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 3,644 ms
コンパイル使用メモリ 77,580 KB
実行使用メモリ 78,976 KB
最終ジャッジ日時 2023-10-25 06:35:40
合計ジャッジ時間 22,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,561 ms
78,976 KB
testcase_01 AC 132 ms
55,356 KB
testcase_02 AC 128 ms
57,244 KB
testcase_03 AC 118 ms
56,276 KB
testcase_04 AC 120 ms
54,228 KB
testcase_05 AC 132 ms
57,016 KB
testcase_06 AC 133 ms
57,456 KB
testcase_07 AC 132 ms
57,524 KB
testcase_08 AC 131 ms
57,464 KB
testcase_09 AC 135 ms
57,296 KB
testcase_10 AC 137 ms
57,408 KB
testcase_11 AC 141 ms
57,392 KB
testcase_12 AC 146 ms
57,648 KB
testcase_13 AC 1,618 ms
78,696 KB
testcase_14 AC 1,599 ms
78,740 KB
testcase_15 AC 1,605 ms
78,928 KB
testcase_16 AC 1,595 ms
72,404 KB
testcase_17 AC 1,618 ms
78,632 KB
testcase_18 AC 1,631 ms
78,704 KB
testcase_19 AC 1,606 ms
78,952 KB
testcase_20 AC 1,614 ms
78,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;
import java.io.PrintWriter;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);

		int h=sc.nextInt();
		int w=sc.nextInt();
		int n=sc.nextInt();
		int x=0;
		int y=0;
		char[] s=new char[n];
		int[] k=new int[n];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray()[0];
			k[i]=sc.nextInt();
		}
		for(int i=n-1;i>=0;i--){
			if(s[i]=='R'&&k[i]==y){
				x=(x-1+w)%w;
			}else if(s[i]=='C'&&k[i]==x){
				y=(y-1+h)%h;
			}
		}

		if((x+y)%2==0){
			pw.println("white");
		}else if((x+y)%2==1){
			pw.println("black");
		}
		pw.close();
		sc.close();
	}
}

0