#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] = '.';
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 |
344 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: 3 |
5 |
Incorrect |
0 ms |
348 KB |
The matrix does not generate the required number of Costins |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Your size: 46 |
2 |
Correct |
0 ms |
504 KB |
Correct! Your size: 47 |
3 |
Correct |
0 ms |
348 KB |
Correct! Your size: 47 |
4 |
Correct |
0 ms |
348 KB |
Correct! Your size: 47 |
5 |
Correct |
0 ms |
344 KB |
Correct! Your size: 47 |
6 |
Incorrect |
0 ms |
348 KB |
The matrix does not generate the required number of Costins |
7 |
Halted |
0 ms |
0 KB |
- |