結果

問題 No.351 市松スライドパズル
ユーザー 37zigen37zigen
提出日時 2016-03-12 03:58:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,674 ms / 2,000 ms
コード長 847 bytes
コンパイル時間 4,027 ms
コンパイル使用メモリ 78,188 KB
実行使用メモリ 79,236 KB
最終ジャッジ日時 2023-10-25 06:34:02
合計ジャッジ時間 23,311 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,494 ms
78,824 KB
testcase_01 AC 131 ms
57,512 KB
testcase_02 AC 133 ms
57,460 KB
testcase_03 AC 134 ms
57,464 KB
testcase_04 AC 132 ms
57,360 KB
testcase_05 AC 134 ms
57,492 KB
testcase_06 AC 131 ms
57,100 KB
testcase_07 AC 134 ms
57,464 KB
testcase_08 AC 133 ms
57,424 KB
testcase_09 AC 138 ms
57,508 KB
testcase_10 AC 136 ms
57,712 KB
testcase_11 AC 143 ms
57,260 KB
testcase_12 AC 144 ms
57,248 KB
testcase_13 AC 1,599 ms
78,892 KB
testcase_14 AC 1,621 ms
79,236 KB
testcase_15 AC 1,646 ms
78,756 KB
testcase_16 AC 1,674 ms
79,020 KB
testcase_17 AC 1,662 ms
79,016 KB
testcase_18 AC 1,574 ms
72,492 KB
testcase_19 AC 1,660 ms
78,752 KB
testcase_20 AC 1,573 ms
72,752 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);
		//long exec_time=new Date().getTime();

		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'){
				if(k[i]==y)
					x=(x-1+w)%w;
			}else if(s[i]=='C'){
				if(k[i]==x)
					y=(y-1+h)%h;
			}
			//pw.println("x="+x+"\ny="+y);

		}

		if((x+y)%2==0){
			pw.println("white");
		}else if((x+y)%2==1){
			pw.println("black");
		}
		pw.close();
		sc.close();
	}
	//System.err.println(new Date().getTime()-exec_time+"ms");

}

0