QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#443665 | #8217. King's Dinner | _l_l_ | WA | 0ms | 3820kb | C++14 | 1.1kb | 2024-06-15 16:15:17 | 2024-06-15 16:15:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
char str[MAXN][MAXN];
int main() {
int t; scanf("%d", &t); while (t--) {
int n; scanf("%d", &n);
if (n == 1) puts(".");
else {
int a = (n + 1) / 3, b = (n + 1) / 2;
int ans = 0;
for (int i = 0; 2 * i <= n + 1; i++) {
ans = max(ans, i * a + (n + 1 - 2 * i) / 3 * b);
}
// printf("%d\n", ans);
for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) str[i][j] = '.';
for (int i = 1; i <= n; i++) str[i][n + 1] = 0;
for (int i = 0; 2 * i <= n + 1; i++) {
if (ans == i * a + (n + 1 - 2 * i) / 3 * b) {
int j = (n + 1 - 2 * i) / 3;
for (int k = 1; k <= i; k++) {
for (int f = 1; f <= a; f++) str[2 * k - 1][3 * f - 2] = '#';
for (int f = 1; f <= a; f++) str[2 * k - 1][3 * f - 1] = '#';
}
for (int k = 1; k <= j; k++) {
for (int f = 1; f <= b; f++) str[2 * i + 3 * k - 2][2 * f - 1] = '#';
for (int f = 1; f <= b; f++) str[2 * i + 3 * k - 1][2 * f - 1] = '#';
}
break;
}
}
for (int i = 1; i <= n; i++) puts(str[i] + 1);
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3744kb
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:
wrong answer jury has the better answer: jans = 4, pans = 3 (test case 4)