QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#392736#8217. King's Dinnerucup-team1359AC ✓5ms3820kbC++141.8kb2024-04-17 20:00:312024-04-17 20:00:32

Judging History

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

  • [2024-04-17 20:00:32]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3820kb
  • [2024-04-17 20:00:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,n,ans[150][150];
int main() {
    cin>>T;
    while (T--) {
        cin>>n;
        n++;
        memset(ans,0,sizeof(ans));
        int x=n%6;
        if (x==1) x=7;
        for (int i=x+1;i<=n;i++) {
            for (int j=1;j<=n;j++) {
                if (n%2==0) {
                    if ((i-x)%3==1) {
                        if (j%2) ans[i][j]=2;
                    }
                } else {
                    if ((i-x)%3==1) {
                        if ((j%2)&&(j<=n-3)) ans[i][j]=2;
                    }
                    if ((i-x)%2) {
                        if (j==n-2) ans[i][j]=1;
                    }
                }
            }
        }
        for (int i=1;i<=x;i++) {
            for (int j=x+1;j<=n;j++) {
                if (x%2==0) {
                    if (i%2) {
                        if ((j-x)%3==1) ans[i][j]=1;
                    }
                } else {
                    if ((i%2)&&(i<=x-3)) {
                        if ((j-x)%3==1) ans[i][j]=1;
                    }
                    if (i==x-2) {
                        if ((j-x)%2) ans[i][j]=2;
                    }
                }
            }
        }
        if (x==3) ans[1][1]=1;
        else if (x==4) ans[1][1]=ans[3][1]=1;
        else if (x==5) {
            ans[1][1]=ans[4][3]=1;
            ans[1][4]=ans[3][1]=2;
        } else if (x==7) {
            ans[1][5]=ans[3][5]=ans[4][1]=ans[6][1]=1;
            ans[1][1]=ans[1][3]=ans[5][4]=ans[5][6]=2;
        }
        for (int i=1;i<n;i++) {
            for (int j=1;j<n;j++) {
                if (ans[i][j]||(ans[i][j-1]==1)||(ans[i-1][j]==2)) cout<<'#';
                else cout<<'.';
            }
            cout<<endl;
        }
    }
    return 0;
}

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

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3820kb

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: 5ms
memory: 3684kb

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed