#include<iostream>
using namespace std;
int n, i, j;
long long k, val;
char a[55][55], dir[55][55];
long long d[55][55];
int main(){
cin>> k;
val = 1;
while(val * 6 <= k){
n++;
val *= 6;
}
n = n * 2 + 3;
for(i = 1; i <= n; i++){
for(j = 1; j <= n; j++){
a[i][j] = '.';
}
}
for(i = 1; i < n; i++){
a[n][i] = 'r';
a[i][n] = 'd';
}
for(i = 1; i < n - 3; i += 2){
a[i][i] = a[i + 1][i] = a[i][i + 1] = a[i + 1][i + 1] = 'X';
a[i][i + 2] = a[i + 1][i + 2] = 'd';
a[i + 2][i] = a[i + 2][i + 1] = 'r';
if(k % 6 == 1){
a[i + 2][i] = 'X';
}
if(k % 6 == 2){
a[i + 2][i] = a[i][i + 2] = 'X';
}
if(k % 6 == 3){
a[i + 2][i + 1] = 'X';
}
if(k % 6 == 4){
a[i + 2][i] = a[i + 2][i + 1] = 'X';
}
if(k % 6 == 5){
a[i + 2][i] = a[i + 2][i + 1] = a[i][i + 2] = 'X';
}
k /= 6;
}
if(k == 2){
a[i][i] = 'X';
}
if(k == 3){
a[i][i] = 'X';
a[i + 1][i] = 'X';
}
if(k == 4){
a[i][i] = a[i + 1][i] = a[i][i + 1] = 'X';
}
if(k == 5){
a[i][i] = a[i + 1][i + 1] = a[i + 1][i] = 'X';
a[i][i + 1] = 'd';
}
cout<< n <<" "<< n <<"\n";
for(i = 1; i <= n; i++){
for(j = 1; j <= n; j++){
cout<< a[i][j];
}
cout<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Correct! Your size: 3 |
2 |
Correct |
1 ms |
204 KB |
Correct! Your size: 3 |
3 |
Correct |
1 ms |
208 KB |
Correct! Your size: 3 |
4 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
5 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
6 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
7 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
8 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
9 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Correct! Your size: 47 |
2 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |
3 |
Correct |
1 ms |
204 KB |
Correct! Your size: 49 |
4 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |
5 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |
6 |
Correct |
1 ms |
204 KB |
Correct! Your size: 49 |
7 |
Correct |
1 ms |
204 KB |
Correct! Your size: 49 |
8 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |