QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511956#8217. King's DinnerfansizheAC ✓1ms3828kbC++201.4kb2024-08-10 13:01:472024-08-10 13:01:47

Judging History

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

  • [2024-08-10 13:01:47]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3828kb
  • [2024-08-10 13:01:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
char mat[105][105];
void solve(int n){
	if(n<=6){
		if(n==2)mat[1][1]=mat[1][2]='#';
		else if(n==3)mat[1][1]=mat[1][2]=mat[3][1]=mat[3][2]='#';
		else if(n==4)mat[1][1]=mat[1][2]=mat[1][4]=mat[2][4]=mat[3][1]=mat[4][1]=mat[4][3]=mat[4][4]='#';
		else if(n==5){
			mat[1][1]=mat[1][2]=mat[1][4]=mat[1][5]='#';
			mat[3][1]=mat[3][2]=mat[3][4]=mat[3][5]='#';
			mat[5][1]=mat[5][2]=mat[5][4]=mat[5][5]='#';
		}else if(n==6){
			mat[1][1]=mat[1][2]=mat[3][1]=mat[3][2]='#';
			mat[1][4]=mat[1][6]=mat[2][4]=mat[2][6]='#';
			mat[5][1]=mat[5][3]=mat[6][1]=mat[6][3]='#';
			mat[4][5]=mat[4][6]=mat[6][5]=mat[6][6]='#';
		}
		return;
	}
	solve(n-6);
	if(n&1){
		for(int i=1;i<=n-6;i+=2)mat[n-4][i]=mat[n-3][i]=mat[n-1][i]=mat[n][i]='#';
		for(int i=1;i<=n;i+=2)mat[i][n-4]=mat[i][n-3]=mat[i][n-1]=mat[i][n]='#';
	}else{
		for(int i=1;i<=n-8;i+=2)mat[n-4][i]=mat[n-3][i]=mat[n-1][i]=mat[n][i]='#';
		mat[n-4][n-7]=mat[n-4][n-6]=mat[n-2][n-7]=mat[n-2][n-6]=mat[n][n-7]=mat[n][n-6]='#';
		for(int i=1;i<=n-2;i+=2)mat[i][n-4]=mat[i][n-3]=mat[i][n-1]=mat[i][n]='#';
		mat[n-1][n-4]=mat[n][n-4]=mat[n-1][n-2]=mat[n][n-2]=mat[n-1][n]=mat[n][n]='#';
	}
}
void solve(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)mat[i][j]='.';
	solve(n);
	for(int i=1;i<=n;i++,puts(""))for(int j=1;j<=n;j++)putchar(mat[i][j]);
}
int main(){
	int _;scanf("%d",&_);
	while(_--)solve();
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed