結果

問題 No.331 CodeRunnerでやれ
ユーザー FF256grhyFF256grhy
提出日時 2015-12-25 08:45:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 310 ms / 5,000 ms
コード長 611 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 26,092 KB
実行使用メモリ 24,508 KB
平均クエリ数 280.00
最終ジャッジ日時 2023-09-23 23:00:46
合計ジャッジ時間 5,839 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
24,288 KB
testcase_01 AC 154 ms
24,036 KB
testcase_02 AC 175 ms
23,860 KB
testcase_03 AC 190 ms
24,004 KB
testcase_04 AC 176 ms
24,024 KB
testcase_05 AC 165 ms
24,276 KB
testcase_06 AC 201 ms
23,580 KB
testcase_07 AC 198 ms
24,292 KB
testcase_08 AC 189 ms
24,016 KB
testcase_09 AC 238 ms
24,076 KB
testcase_10 AC 276 ms
23,428 KB
testcase_11 AC 214 ms
23,412 KB
testcase_12 AC 226 ms
23,656 KB
testcase_13 AC 248 ms
23,412 KB
testcase_14 AC 262 ms
24,024 KB
testcase_15 AC 270 ms
24,040 KB
testcase_16 AC 310 ms
24,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

#define FS fflush(stdout); scanf("%s", s);
#define R printf("R\n"); FS r = (r + 1) % 4;
#define L printf("L\n"); FS r = (r + 3) % 4;
#define F printf("F\n"); FS x += dx[r]; y += dy[r]; if(s[0] == 'M') { return 1; }

int f[38][38], x, y, r;
int dx[4] = { 1, 0, -1,  0 };
int dy[4] = { 0, 1,  0, -1 };
char s[17];

int p(void) {
	f[x][y] = 1;
	R
	
	int i;
	for(i = 0; i < 3; i++) {
		if(s[0] != '0' && f[ x + dx[r] ][ y + dy[r] ] == 0) {
			F
			if( p() ) { return 1; }
			R
		} else {
			L
		}
	}
	
	F
	
	return 0;
}

int main(void) {
	int n;
	x = y = 19;
	scanf("%s", s);
	p();
	return 0;
}
0