QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#350189#8217. King's Dinnerwillow#AC ✓1ms3796kbC++172.1kb2024-03-10 15:11:102024-03-10 15:11:14

Judging History

你现在查看的是最新测评结果

  • [2024-03-10 15:11:14]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3796kb
  • [2024-03-10 15:11:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T, n;
int mat[105][105];
int main() {
    for(scanf("%d", &T); T --; ) {
        scanf("%d", &n);
        for(int i = 0; i < n; ++ i)
            for(int j = 0; j < n; ++ j)
                mat[i][j] = 0;
        if(n % 2 == 0) {
            int l = 0, r = n - 1;
            while(r - l + 1 >= 4) {
                for(int i = l; i < r - 2; i += 2) {
                    mat[l][i] = mat[l + 1][i] = 1;
                    mat[i][r - 1] = mat[i][r] = 1;
                }
                for(int i = r; i > l + 2; i -= 2) {
                    mat[r][i] = mat[r - 1][i] = 1;
                    mat[i][l] = mat[i][l + 1] = 1;
                }
                l += 3;
                r -= 3;
            }
            if(r - l + 1 == 2) {
                mat[l][l] = mat[l + 1][l] = 1;
            }
        }
        else if(n % 6 == 5) {
            for(int i = 0; i < n; i += 2) {
                for(int j = 0; j < n; j += 3) {
                    mat[i][j] = mat[i][j + 1] = 1;
                }
            }
        }
        else {
            int l = 0, r = n - 1;
            if(n % 6 == 1) {
                for(int i = 0; i < r - 2; i += 3) {
                    mat[l][i] = mat[l][i + 1] = 1;
                    mat[i][r] = mat[i + 1][r] = 1;
                }
                for(int i = r; i > l + 2; i -= 3) {
                    mat[r][i] = mat[r][i - 1] = 1;
                    mat[i][l] = mat[i - 1][l] = 1;
                }
                l += 2, r -= 2;
            }
            for(int i = l; i < r - 2; i += 3) {
                for(int j = l; j <= r; j += 2) {
                    mat[i][j] = mat[i + 1][j] = 1;
                }
            }
            for(int i = l; i <= r - 2; i += 3) {
                mat[r - 2][i] = mat[r - 2][i + 1] = 1;
                mat[r][i] = mat[r][i + 1] = 1;
            }
        }
        for(int i = 0; i < n; ++ i) {
            for(int j = 0; j < n; ++ j) {
                putchar(mat[i][j] ? '#' : '.');
            }
            puts("");
        }
    }
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3796kb

input:

3
1
2
3

output:

.
#.
#.
##.
...
##.

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3764kb

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: 1ms
memory: 3648kb

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: 3776kb

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: 3784kb

input:

1
100

output:

#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
.....................................................................................................

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed