답안 #869837

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869837 2023-11-05T21:17:20 Z rainboy Costinland (info1cup19_costinland) C
100 / 100
1 ms 424 KB
#include <stdio.h>

#define N	49

int main() {
	static char cc[N][N + 1];
	int n, i, j;
	long long k;

	scanf("%lld", &k);
	n = 0;
	while (k >= 6) {
		cc[n + 0][n + 0] = 'X', cc[n + 0][n + 1] = 'X', cc[n + 0][n + 2] = 'd';
		cc[n + 1][n + 0] = 'X', cc[n + 1][n + 1] = 'X', cc[n + 1][n + 2] = 'd';
		cc[n + 2][n + 0] = 'r', cc[n + 2][n + 1] = 'r', cc[n + 2][n + 2] = '.';
		if (k / 3 % 2 == 1)
			cc[n + 1][n + 2] = 'X';
		if (k % 3 == 1)
			cc[n + 0][n + 2] = 'X';
		else if (k % 3 == 2)
			cc[n + 0][n + 2] = 'X', cc[n + 2][n + 0] = 'X';
		n += 2, k /= 6;
	}
	if (k == 1) {
		cc[n + 0][n + 0] = 'r', cc[n + 0][n + 1] = 'd';
		cc[n + 1][n + 0] = 'r', cc[n + 1][n + 1] = '.';
		n++;
	} else if (k == 2) {
		cc[n + 0][n + 0] = 'X', cc[n + 0][n + 1] = 'd';
		cc[n + 1][n + 0] = 'r', cc[n + 1][n + 1] = '.';
		n++;
	} else if (k == 3) {
		cc[n + 0][n + 0] = 'X', cc[n + 0][n + 1] = 'X', cc[n + 0][n + 2] = 'd';
		cc[n + 1][n + 0] = 'd', cc[n + 1][n + 1] = 'd', cc[n + 1][n + 2] = 'd';
		cc[n + 2][n + 0] = 'r', cc[n + 2][n + 1] = 'r', cc[n + 2][n + 2] = '.';
		n += 2;
	} else if (k == 4) {
		cc[n + 0][n + 0] = 'X', cc[n + 0][n + 1] = 'd', cc[n + 0][n + 2] = 'd';
		cc[n + 1][n + 0] = 'r', cc[n + 1][n + 1] = 'X', cc[n + 1][n + 2] = 'd';
		cc[n + 2][n + 0] = 'r', cc[n + 2][n + 1] = 'r', cc[n + 2][n + 2] = '.';
		n += 2;
	} else {
		cc[n + 0][n + 0] = 'X', cc[n + 0][n + 1] = 'X', cc[n + 0][n + 2] = 'd';
		cc[n + 1][n + 0] = 'r', cc[n + 1][n + 1] = 'X', cc[n + 1][n + 2] = 'd';
		cc[n + 2][n + 0] = 'r', cc[n + 2][n + 1] = 'r', cc[n + 2][n + 2] = '.';
		n += 2;
	}
	n++;
	printf("%d %d\n", n, n);
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			if (cc[i][j] == 0)
				cc[i][j] = '.';
	for (i = 0; i + 1 < n; i++)
		cc[i][n - 1] = 'd';
	for (j = 0; j + 1 < n; j++)
		cc[n - 1][j] = 'r';
	for (i = 0; i < n; i++)
		printf("%s\n", cc[i]);
	return 0;
}

Compilation message

costinland.c: In function 'main':
costinland.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%lld", &k);
      |  ^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Correct! Your size: 3
2 Correct 0 ms 348 KB Correct! Your size: 3
3 Correct 0 ms 348 KB Correct! Your size: 3
4 Correct 0 ms 348 KB Correct! Your size: 4
5 Correct 0 ms 348 KB Correct! Your size: 4
6 Correct 0 ms 424 KB Correct! Your size: 4
7 Correct 0 ms 348 KB Correct! Your size: 4
8 Correct 0 ms 348 KB Correct! Your size: 4
9 Correct 0 ms 348 KB Correct! Your size: 5
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Correct! Your size: 46
2 Correct 0 ms 348 KB Correct! Your size: 47
3 Correct 0 ms 348 KB Correct! Your size: 48
4 Correct 1 ms 344 KB Correct! Your size: 47
5 Correct 0 ms 348 KB Correct! Your size: 47
6 Correct 0 ms 348 KB Correct! Your size: 48
7 Correct 0 ms 348 KB Correct! Your size: 48
8 Correct 0 ms 392 KB Correct! Your size: 46