結果

問題 No.351 市松スライドパズル
ユーザー FF256grhyFF256grhy
提出日時 2016-03-24 16:06:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 22,376 KB
実行使用メモリ 6,328 KB
最終ジャッジ日時 2023-10-25 07:42:32
合計ジャッジ時間 2,843 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
6,328 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 133 ms
6,244 KB
testcase_14 AC 134 ms
6,268 KB
testcase_15 AC 136 ms
6,328 KB
testcase_16 AC 136 ms
6,328 KB
testcase_17 AC 131 ms
6,328 KB
testcase_18 AC 131 ms
6,328 KB
testcase_19 AC 135 ms
6,328 KB
testcase_20 AC 136 ms
6,328 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d%d%d", &h, &w, &n);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:11:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         for(i = 0; i < n; i++) { scanf("%*c%c%d", &s[i], &k[i]); }
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

#define MAX 1000000

int h, w, n, k[MAX];
char s[MAX];

int main(void) {
	scanf("%d%d%d", &h, &w, &n);
	int i;
	for(i = 0; i < n; i++) { scanf("%*c%c%d", &s[i], &k[i]); }
	
	int hh = 0, ww = 0;
	for(i = n - 1; 0 <= i; i--) {
		if(s[i] == 'R' && k[i] == hh) { ww = (ww + (w - 1)) % w; }
		if(s[i] == 'C' && k[i] == ww) { hh = (hh + (h - 1)) % h; }
	}
	
	printf("%s\n", (hh + ww) % 2 == 0 ? "white" : "black");
	
	return 0;
}
0