#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
long long k = 0;
cin >> k;
int largestbit = 0;
for (int i = 60; i >= 0; i--)
if ((k & (1ll << i))) {
largestbit = i;
break;
}
k = (k ^ (1ll << largestbit));
int siz = max (
largestbit + 1,
5
);
vector <string> gr (siz, string (siz, '.'));
for (int i = 0; i < largestbit; i++) {
gr[i][i] = 'X';
gr[i + 1][i] = 'r';
gr[i][i + 1] = 'd';
}
for (int i = 0; i < siz - 1; i++) {
gr[siz - 1][i] = 'r';
gr[i][siz - 1] = 'd';
}
for (int i = 2; i < largestbit; i++)
if ((k & (1ll << i))) {
gr[i][i - 1] = 'X';
gr[i - 1][i] = 'X';
}
if ((k & 2ll) && (k & 1ll)) {
gr[1][0] = 'X';
gr[0][1] = 'X';
gr[siz - 2][0] = 'X';
gr[siz - 2][1] = 'd';
} else if ((k & 2ll)) {
gr[1][0] = 'X';
gr[0][1] = 'X';
} else if ((k & 1ll)) {
gr[1][0] = 'X';
}
cout << siz << ' ' << siz << '\n';
for (int y = 0; y < siz; y++)
cout << gr[y] << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
2 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
3 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
4 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
5 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
6 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
7 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
8 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
9 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 59 |
2 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 59 |
3 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 60 |
4 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 60 |
5 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 60 |
6 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 60 |
7 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 60 |
8 |
Partially correct |
0 ms |
344 KB |
Partially Correct! Your size: 58 |