QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511919#8217. King's DinnerSDSXCAC ✓1ms3824kbC++141.8kb2024-08-10 12:29:572024-08-10 12:29:58

Judging History

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

  • [2024-08-10 12:29:58]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3824kb
  • [2024-08-10 12:29:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,n;
bool c[109][109];
int main(){
	scanf("%d",&T);
	while(T--){
		memset(c,0,sizeof(c));
		scanf("%d",&n);
		if(n%6==1){
			for(int i=3;i<n;i+=3){
				c[1][i]=c[1][i+1]=1;
			}
			for(int i=3;i<n;i+=3){
				for(int j=1;j<=n;j+=2){
					c[i+1][j]=c[i][j]=1;
				}
			}
		}
		else if(n%6==2){
			for(int i=2;i<=n;i+=2) c[1][i]=c[2][i]=1;
			for(int i=4;i<=n;i+=2) for(int j=1;j<=n;j+=3) c[i][j]=c[i][j+1]=1;
		}
		else if(n%6==3){
			for(int i=2;i<=n;i+=3)c[i][1]=c[i+1][1]=c[i][3]=c[i+1][3]=1;
			for(int i=1;i<=n;i+=2)for(int j=5;j<=n;j+=3) c[i][j]=c[i][j+1]=1;
		}
		else if(n%6==4){
			c[1][1]=c[1][2]=c[1][4]=c[2][4]=c[3][1]=c[4][1]=c[4][3]=c[4][4]=1;
			for(int i=6;i<=n;i+=6) c[1][i]=c[1][i+2]=c[1][i+4]=c[2][i]=c[2][i+2]=c[2][i+4]=c[4][i]=c[4][i+1]=c[4][i+3]=c[4][i+4]=1;
			for(int i=6;i<=n;i+=6) c[i][1]=c[i+2][1]=c[i+4][1]=c[i][2]=c[i+2][2]=c[i+4][2]=c[i][4]=c[i+1][4]=c[i+3][4]=c[i+4][4]=1;
			for(int i=6;i<=n;i+=2) for(int j=6;j<n;j+=3) c[i][j]=c[i][j+1]=1;
		}
		else if(n%6==5){
			for(int i=1;i<=n;i+=2) for(int j=1;j<n;j+=3) c[i][j]=c[i][j+1]=1;
		}
		else if(n%6==0){
			c[1][1]=c[1][3]=c[1][5]=c[1][6]=c[2][1]=c[2][3]=c[3][5]=c[3][6]=c[4][1]=c[4][2]=c[5][4]=c[5][6]=c[6][1]=c[6][2]=c[6][4]=c[6][6]=1;
			for(int i=8;i<=n;i+=6) c[1][i]=c[1][i+1]=c[1][i+3]=c[1][i+4]=c[3][i]=c[3][i+1]=c[3][i+3]=c[3][i+4]=c[5][i]=c[5][i+2]=c[5][i+4]=c[6][i]=c[6][i+2]=c[6][i+4]=1;
			for(int i=8;i<=n;i+=6) c[i][1]=c[i+1][1]=c[i+3][1]=c[i+4][1]=c[i][3]=c[i+1][3]=c[i+3][3]=c[i+4][3]=c[i][5]=c[i+2][5]=c[i+4][5]=c[i][6]=c[i+2][6]=c[i+4][6]=1;
			for(int i=8;i<=n;i+=2) for(int j=8;j<=n;j+=3) c[i][j]=c[i][j+1]=1;
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(c[i][j]){
					putchar('#');
				}
				else{
					putchar('.');
				}
			}
			putchar('\n');
		}
	}
	return 0;
}

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

详细

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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: 0ms
memory: 3636kb

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed