QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340182 | #8217. King's Dinner | ucup-team191# | AC ✓ | 3ms | 1608kb | C++23 | 2.5kb | 2024-02-28 17:59:06 | 2024-02-28 17:59:06 |
Judging History
answer
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 105;
int n, A[N][N];
void solve() {
memset(A, 0, sizeof(A));
scanf("%d", &n);
int cnt = 0;
if(n % 6 == 5 || n % 6 == 1) {
for(int i = 0;i + 1 < n;i += 3) {
for(int j = 0;j < n;j += 2)
A[i][j] = 1, A[i + 1][j] = 1;
}
if(n % 3 == 1) {
for(int j = 0;j + 1 < n;j += 3)
A[n - 1][j] = 1, A[n - 1][j + 1] = 1;
}
for(int i = 0;i < n;i++) {
for(int j = 0;j < n;j++)
printf(A[i][j] ? "#" : "."), cnt += A[i][j];
printf("\n");
}
}
if(n % 6 == 2) {
for(int i = 0;i + 1 < n;i += 3)
for(int j = 0;j < n - 3;j += 2)
A[i][j] = 1, A[i + 1][j] = 1;
for(int i = 0;i < n;i += 2)
A[i][n - 2] = 1, A[i][n - 1] = 1;
for(int i = 0;i < n;i++) {
for(int j = 0;j < n;j++)
printf(A[i][j] ? "#" : "."), cnt += A[i][j];
printf("\n");
}
}
if(n % 6 == 4) {
A[0][0] = 1; A[1][0] = 1;
A[0][2] = 1; A[0][3] = 1;
A[3][0] = 1; A[3][1] = 1;
// A[2][3] = 1; A[3][3] = 1;
for(int i = 5;i + 1 < n;i += 3)
A[0][i] = 1, A[0][i + 1] = 1;
for(int i = 5;i < n;i += 2)
A[i][0] = 1, A[i][1] = 1;
for(int i = 2;i + 1 < n;i += 3)
for(int j = 3;j < n;j += 2)
A[i][j] = 1, A[i + 1][j] = 1;
for(int i = 0;i < n;i++) {
for(int j = 0;j < n;j++)
printf(A[i][j] ? "#" : "."), cnt += A[i][j];
printf("\n");
}
}
if(n % 6 == 0) {
A[0][0] = 1; A[1][0] = 1;
A[0][2] = 1; A[1][2] = 1;
A[0][4] = 1; A[0][5] = 1;
A[2][4] = 1; A[2][5] = 1;
A[3][0] = 1; A[3][1] = 1;
A[5][0] = 1; A[5][1] = 1;
A[4][3] = 1; A[5][3] = 1;
A[4][5] = 1; A[5][5] = 1;
for(int i = 7;i < n;i += 3)
A[0][i] = 1, A[0][i + 1] = 1,
A[2][i] = 1, A[2][i + 1] = 1,
A[i][3] = 1, A[i + 1][3] = 1,
A[i][5] = 1, A[i + 1][5] = 1;
for(int i = 7;i < n;i += 2)
A[4][i] = 1, A[5][i] = 1,
A[i][0] = 1, A[i][1] = 1;
for(int i = 7;i < n;i += 3) {
for(int j = 7;j < n;j += 2)
A[i][j] = 1, A[i + 1][j] = 1;
}
for(int i = 0;i < n;i++) {
for(int j = 0;j < n;j++)
printf(A[i][j] ? "#" : "."), cnt += A[i][j];
printf("\n");
}
}
if(n % 6 == 3) {
for(int i = 0;i + 1 < n - 4;i += 3)
for(int j = 0;j < n;j += 2)
A[i][j] = 1, A[i + 1][j] = 1;
for(int j = 0;j < n;j += 3)
A[n - 3][j] = 1, A[n - 3][j + 1] = 1,
A[n - 1][j] = 1, A[n - 1][j + 1] = 1;
for(int i = 0;i < n;i++) {
for(int j = 0;j < n;j++)
printf(A[i][j] ? "#" : "."), cnt += A[i][j];
printf("\n");
}
}
}
int main(){
int T; scanf("%d", &T);
for(;T--;) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1608kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 1576kb
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: 3ms
memory: 1600kb
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: 2ms
memory: 1584kb
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: 1576kb
input:
1 100
output:
#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #................................................................................................... ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed