結果

問題 No.2339 Factorial Paths
ユーザー 👑 ygussanyygussany
提出日時 2023-06-03 20:52:51
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 28,516 KB
実行使用メモリ 5,104 KB
最終ジャッジ日時 2023-08-28 08:03:41
合計ジャッジ時間 7,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 0 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 7 ms
4,928 KB
testcase_18 AC 7 ms
4,916 KB
testcase_19 AC 7 ms
5,104 KB
testcase_20 AC 7 ms
4,932 KB
testcase_21 AC 7 ms
5,024 KB
testcase_22 AC 8 ms
5,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

void DFS(int N, int *H, int *W, char S[][2001])
{
	if (N == 1) return;
	
	int i, j, n[2] = {N / 2, N - N / 2};
	for (i = *H; i <= *H + n[0]; i++) for (j = *W; j <= *W + n[1]; j++) S[i][j] = '.';
	*H += n[0];
	*W += n[1];
	DFS(n[0], H, W, S);
	DFS(n[1], H, W, S);
}

int main()
{
	int N;
	scanf("%d", &N);
	
	int i, j, H = 0, W = 0;
	static char S[2001][2001] = {};
	DFS(N, &H, &W, S);
	H++;
	W++;
	for (i = 0; i < H; i++) for (j = 0; j < W; j++) if (S[i][j] == 0) S[i][j] = '#';
	printf("%d %d\n", H, W);
	for (i = 0; i < H; i++) printf("%s\n", S[i]);
	fflush(stdout);
	return 0;
}
0