QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#323208 | #8217. King's Dinner | karuna | AC ✓ | 1ms | 3676kb | C++20 | 1.8kb | 2024-02-08 20:42:18 | 2024-02-08 20:42:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
int a[MAXN][MAXN];
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
for (int x = 0; x <= n; x++) for (int y = 0; y <= n; y++) {
a[x][y] = 0;
}
int r = n % 6 + 1;
if (r == 1) r += 6;
int k = (n + 1 - r) / 6;
for (int y = 0; y < 6 * k; y += 6) {
for (int s = r, x = 0; s;) {
if (s % 2 == 1) {
a[x][y] = 1;
a[x][y + 2] = 1;
a[x][y + 4] = 1;
a[r + y][6 * k + x] = 2;
a[r + y + 2][6 * k + x] = 2;
a[r + y + 4][6 * k + x] = 2;
s -= 3;
x += 3;
}
else {
a[x][y] = 2;
a[x][y + 3] = 2;
a[r + y][6 * k + x] = 1;
a[r + y + 3][6 * k + x] = 1;
s -= 2;
x += 2;
}
}
}
for (int x = r; x < n; x += 2) {
for (int y = 0; y < 6 * k; y += 3) {
a[x][y] = 2;
}
}
if (r == 3) {
a[0][6 * k] = 2;
}
if (r == 4) {
a[0][6 * k] = 2;
a[2][6 * k] = 2;
}
if (r == 5) {
a[0][6 * k] = 2;
a[0][6 * k + 3] = 1;
a[2][6 * k] = 1;
a[3][6 * k + 2] = 2;
}
if (r == 6) {
a[0][6 * k] = 2;
a[0][6 * k + 3] = 2;
a[2][6 * k] = 2;
a[2][6 * k + 3] = 2;
a[4][6 * k] = 2;
a[4][6 * k + 3] = 2;
}
if (r == 7) {
a[0][6 * k] = 1;
a[0][6 * k + 2] = 1;
a[0][6 * k + 4] = 2;
a[2][6 * k + 4] = 2;
a[4][6 * k + 5] = 1;
a[4][6 * k + 3] = 1;
a[5][6 * k] = 2;
a[3][6 * k] = 2;
}
for (int x = 0; x < n; x++) {
for (int y = 0; y < n; y++) {
if (a[x][y] == 1) {
a[x][y] = a[x + 1][y] = 3;
}
if (a[x][y] == 2) {
a[x][y] = a[x][y + 1] = 3;
}
cout << (a[x][y] ? '#' : '.');
}
cout << '\n';
}
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3628kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3596kb
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: 0ms
memory: 3676kb
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: 3672kb
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: 1ms
memory: 3612kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....# ................................................................................................#....
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed