QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#414469#8217. King's Dinnerucup-team1231#AC ✓3ms3840kbC++172.6kb2024-05-19 01:47:242024-05-19 01:47:25

Judging History

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

  • [2024-05-19 01:47:25]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3840kb
  • [2024-05-19 01:47:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
typedef pair<int,int> pii;
#define mp make_pair
typedef long long int LLI;

char ans[100][100];
int main() {
    int i;
    int t,n;
    scanf("%d",&t);
    while (t--) {
        scanf("%d",&n);

        n++;
        int N = n;
        memset(ans,'.',sizeof(ans));
        while ((n >= 6) && (n != 7)) {
            ans[n-6][n-6] = ans[n-6][n-5] = '#';
            ans[n-6][n-3] = ans[n-6][n-2] = '#';
            ans[n-4][n-6] = ans[n-4][n-5] = '#';
            ans[n-4][n-3] = ans[n-4][n-2] = '#';
            ans[n-2][n-6] = ans[n-2][n-5] = '#';
            ans[n-2][n-3] = ans[n-2][n-2] = '#';
            if (n & 1) {
                for (i = 0; i < n-9; i += 2) {
                    ans[i][n-6] = ans[i][n-5] = '#';
                    ans[i][n-3] = ans[i][n-2] = '#';
                    ans[n-6][i] = ans[n-5][i] = '#';
                    ans[n-3][i] = ans[n-2][i] = '#';
                }
                ans[n-9][n-6] = '#',ans[n-8][n-6] = '#';
                ans[n-9][n-4] = '#',ans[n-8][n-4] = '#';
                ans[n-9][n-2] = '#',ans[n-8][n-2] = '#';
                ans[n-6][n-9] = '#',ans[n-6][n-8] = '#';
                ans[n-4][n-9] = '#',ans[n-4][n-8] = '#';
                ans[n-2][n-9] = '#',ans[n-2][n-8] = '#';
            }
            else {
                for (i = 0; i < n-6; i += 2) {
                    ans[i][n-6] = ans[i][n-5] = '#';
                    ans[i][n-3] = ans[i][n-2] = '#';
                    ans[n-6][i] = ans[n-5][i] = '#';
                    ans[n-3][i] = ans[n-2][i] = '#';
                }
            }
            n -= 6;
        }
        if (n == 7) {
            ans[0][0] = ans[0][1] = '#';
            ans[2][0] = ans[2][1] = '#';
            ans[0][3] = ans[1][3] = '#';
            ans[0][5] = ans[1][5] = '#';
            ans[4][0] = ans[5][0] = '#';
            ans[4][2] = ans[5][2] = '#';
            ans[3][4] = ans[3][5] = '#';
            ans[5][4] = ans[5][5] = '#';
        }
        else if (n == 5) {
            ans[0][0] = ans[1][0] = '#';
            ans[0][2] = ans[0][3] = '#';
            ans[3][0] = ans[3][1] = '#';
            ans[2][3] = ans[3][3] = '#';
        }
        else if (n == 4) {
            ans[0][0] = ans[1][0] = '#';
            ans[0][2] = ans[1][2] = '#';
        }
        else if (n == 3) {
            ans[0][0] = ans[1][0] = '#';
        }
        
        int j;
        for (i = 0; i < N-1; i++) {
            for (j = 0; j < N-1; j++) printf("%c",ans[i][j]);
            printf("\n");
        }
    }

    return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3724kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 2ms
memory: 3840kb

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

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: 3ms
memory: 3732kb

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed