QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#533731 | #8217. King's Dinner | Phang | AC ✓ | 2ms | 3732kb | C++14 | 2.3kb | 2024-08-26 12:01:30 | 2024-08-26 12:01:30 |
Judging History
answer
#include<bits/stdc++.h>
#define rep1(i, a, b) for(int i = a; i <= b; ++i)
#define rep2(i, a, b) for(int i = a; i >= b; --i)
#define ft first
#define sd second
#define pii pair <int, int>
#define ll long long
#define pb push_back
#define ptc putchar
#define ld long double
#define debug puts("------------------")
const int N = 110;;
using namespace std;
int T; char a[N][N];
int main() {
cin >> T;
while(T--) {
int n, x, m;
// cout << T << '\n';
cin >> n; m = n;
rep1(i, 1, m) rep1(j, 1, m) a[i][j] = '.';
++n; x = n % 6;
// rep1(i, 1, m) {rep1(j, 1, m) cout << a[i][j]; puts("");}
if(x != 2 && x) a[1][1] = a[2][1] = '#';
if(x == 4) a[1][3] = a[2][3] = '#';
if(x == 5) {
a[4][1] = a[4][2] = '#';
a[1][3] = a[1][4] = '#';
a[3][4] = a[4][4] = '#';
}
if(x == 1) {
x += 6;
a[1][3] = a[2][3] = '#';
a[4][1] = a[4][2] = '#'; a[6][1] = a[6][2] = '#';
a[1][5] = a[1][6] = '#'; a[3][5] = a[3][6] = '#';
a[5][4] = a[6][4] = '#'; a[5][6] = a[6][6] = '#';
}
while(n > x) {
int nxt = n - 6;
rep1(i, 1, 3) {
a[n - 5][n - 2 * i + 1] = '#';
a[n - 4][n - 2 * i + 1] = '#';
a[n - 2][n - 2 * i + 1] = '#';
a[n - 1][n - 2 * i + 1] = '#';
}
int tp = nxt & 1;
if(tp && nxt > 1) {
tp += 2;
rep1(i, 1, 3) {
a[n - 2 * i + 1][n - 8] = '#';
a[n - 2 * i + 1][n - 7] = '#';
a[n - 8][n - 2 * i + 1] = '#';
a[n - 7][n - 2 * i + 1] = '#';
}
}
rep1(i, 1, nxt - tp) {
if((i & 1) == 0) continue;
a[i][n - 5] = a[i][n - 4] = a[i][n - 2] = a[i][n - 1] = '#';
a[n - 5][i] = a[n - 4][i] = a[n - 2][i] = a[n - 1][i] = '#';
}
n = nxt;
}
rep1(i, 1, m) {rep1(j, 1, m) cout << a[i][j]; puts("");}
// debug;
}
return 0;
}
/*
##.
...
#.
#.
..
#.#.#.
#.#.#.
......
##.#.#.#.
...#.#.#.
##.......
...#.#.#.
##.#.#.#.
.........
*/
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
50 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
output:
. #. #. #.# #.# ... #.## #... ...# ##.# #.#.# #.#.# ..... #.#.# #.#.# #.#.## #.#... ....## ##.... ...#.# ##.#.# ..##.## ....... #.#.#.# #.#.#.# ....... #.#.#.# #.#.#.# #..#.#.# #..#.#.# ........ ##.#.#.# ...#.#.# ##...... ...#.#.# ##.#.#.# #.#.##.## #.#...... ....##.## ......... #.#.#.#.# #.#.#.#.# ...
result:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #.#................................................ ....##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## ................................................... #.#.#.#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.## #.#.#.#.#..................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #.#....................................................................................... ....##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## ##............................
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1 100
output:
#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #................................................................................................... ...#.#.#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##....
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed