QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514156#8217. King's Dinnerwallace114514AC ✓2ms3748kbC++141.6kb2024-08-10 22:24:002024-08-10 22:24:00

Judging History

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

  • [2024-08-10 22:24:00]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3748kb
  • [2024-08-10 22:24:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=105;
 
int t,n;
char a[N][N];
char m[N][N][N]={
	{{'.'}},{{'#','.'},{'#','.'}},{{'#','#','.'},{'.','.','.'},{'#','#','.'}},
	{{'#','.','#','#'},{'#','.','.','.'},{'.','.','.','#'},{'#','#','.','#'}},
	{{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'}},
	{{'#','#','.','#','.','#'},{'.','.','.','#','.','#'},{'#','#','.','.','.','.'},{'.','.','.','.','#','#'},{'#','.','#','.','.','.'},{'#','.','#','.','#','#'}},
	{{'#','.','#','.','#','.','#'},
	{'#','.','#','.','#','.','#'},
	{'.','.','.','.','.','.','.'},
	{'#','.','#','.','#','.','#'},
	{'#','.','#','.','#','.','#'},
	{'.','.','.','.','.','.','.'},
	{'#','#','.','#','#','.','.'}
	}
};
void dfs(int x) {
	if(x>7) {
		if(x%2==0) {
			for(int i=1;i<=x-8;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
			a[x][x-7]=a[x][x-6]=a[x-2][x-7]=a[x-2][x-6]=a[x-4][x-7]=a[x-4][x-6]='#';
			for(int i=1;i<=x-2;i+=2) a[i][x-4]=a[i][x-3]=a[i][x-1]=a[i][x]='#';
			a[x][x]=a[x-1][x]=a[x][x-2]=a[x-1][x-2]=a[x][x-4]=a[x-1][x-4]='#';
		}else {
			for(int i=1;i<=x-6;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
			for(int i=1;i<=x;i+=2) a[i][x-4]=a[i][x-3]=a[i][x-1]=a[i][x]='#';
		}
		dfs(x-6);
		return;
	}
	for(int i=1;i<=x;i++) {
		for(int j=1;j<=x;j++) {
			a[i][j]=m[x-1][i-1][j-1];
		} 
	}
}

int main(){
	cin>>t;
	while(t--) {
		cin>>n;
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) {
				a[i][j]='.';
			}
		}
		dfs(n);
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) cout<<a[i][j];
			cout<<endl;
		}
	}
	return 0;
}

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

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed