結果

問題 No.351 市松スライドパズル
ユーザー 37zigen37zigen
提出日時 2016-03-12 04:00:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,714 ms / 2,000 ms
コード長 833 bytes
コンパイル時間 3,307 ms
コンパイル使用メモリ 77,856 KB
実行使用メモリ 79,236 KB
最終ジャッジ日時 2023-10-25 06:34:39
合計ジャッジ時間 22,033 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,515 ms
79,132 KB
testcase_01 AC 129 ms
57,252 KB
testcase_02 AC 128 ms
57,480 KB
testcase_03 AC 132 ms
57,500 KB
testcase_04 AC 131 ms
57,568 KB
testcase_05 AC 131 ms
57,236 KB
testcase_06 AC 120 ms
56,288 KB
testcase_07 AC 134 ms
57,604 KB
testcase_08 AC 130 ms
57,300 KB
testcase_09 AC 138 ms
57,716 KB
testcase_10 AC 135 ms
57,628 KB
testcase_11 AC 143 ms
57,788 KB
testcase_12 AC 144 ms
57,512 KB
testcase_13 AC 1,714 ms
78,752 KB
testcase_14 AC 1,681 ms
79,080 KB
testcase_15 AC 1,609 ms
72,500 KB
testcase_16 AC 1,599 ms
79,236 KB
testcase_17 AC 1,588 ms
78,800 KB
testcase_18 AC 1,625 ms
78,860 KB
testcase_19 AC 1,495 ms
72,936 KB
testcase_20 AC 1,546 ms
79,120 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'&&k[i]==y){
					x=(x-1+w)%w;
			}else if(s[i]=='C'&&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