QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516802#8217. King's DinnerwyhaoWA 1ms3884kbC++142.4kb2024-08-12 21:53:272024-08-12 21:53:27

Judging History

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

  • [2024-08-12 21:53:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3884kb
  • [2024-08-12 21:53:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=105;
char ch[N][N];
int n;
int main(){
    int tests;
    scanf("%d",&tests);
    while(tests--){
        scanf("%d",&n);
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                ch[i][j]='.';
            }
            ch[i][n+1]=0;
        }
        if(n%6==0){
            for(int i=1;i<=n;i+=3){
                    for(int j=1;j<n-2;j+=2){
                        ch[i][j]=ch[i+1][j]='#';
                    }
                }
                for(int i=1;i<=n;i+=2){
                    ch[i][n-1]=ch[i][n]='#';
                }
        }else if(n%6==1){
            for(int i=1;i+1<n;i+=3){
                    for(int j=1;j<=n;j+=2){
                        ch[i][j]='#';
                        ch[i+1][j]='#';
                    }
                }
                for(int j=1;j<n;j+=3) ch[n][j]=ch[n][j+1]='#';
        }else if(n%6==2){
            for(int i=1;i<=n;i+=3){
                    for(int j=1;j<n-2;j+=2){
                        ch[i][j]=ch[i+1][j]='#';
                    }
                }
                for(int i=1;i<=n;i+=2){
                    ch[i][n-1]=ch[i][n]='#';
                }
        }else if(n%6==3){
            for(int i=1;i+3<=n;i+=3){
                for(int j=1;j<=n;j+=2){
                    ch[i][j]='#';
                    ch[i+1][j]='#';
                }
            }
            for(int j=1;j<n;j+=3){
                ch[n-2][j]=ch[n-2][j+1]='#';
                ch[n][j]=ch[n][j+1]='#';
            }
        }else if(n%6==4){
            for(int i=1;i+3<=n;i+=3){
                    for(int j=1;j+2<n;j+=2){
                        ch[i][j]='#';
                        ch[i+1][j]='#';
                    }
                }
                for(int i=1;i+2<n;i+=2){
                    ch[i][n-1]=ch[i][n]='#';
                }
                for(int j=1;j+3<=n;j+=3){
                    ch[n][j]=ch[n][j+1]='#';
                }
                ch[n-1][n]=ch[n][n]='#';
        }else if(n%6==5){
            for(int i=1;i<=n;i+=3){
                    for(int j=1;j<=n;j+=2){
                        ch[i][j]='#';
                        ch[i+1][j]='#';
                    }
                }
        }
        for(int i=1;i<=n;i++) printf("%s\n",ch[i]+1);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
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:

wrong answer jury has the better answer: jans = 8, pans = 7 (test case 6)