UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212082#3815. 种树13914031549101ms1192kbC++572b2024-10-13 11:03:012024-10-13 12:55:54

answer

#include<bits/stdc++.h>
using namespace std;
int vis[30][30];
int n,m,k;
int dir[][2]={0,1,1,0,0,-1,-1,0};
long long cnt=0;
void DFS(int r,int c,int s){
	if(s>=k){
		cnt++;
	}
	else if(r==n&&c==m){
		return;
	}
	for(int K=0;K<4;K++){
		int dr=r+dir[K][0],dc=c+dir[K][1];
		if(1<=dr&&dr<=n&&1<=dc&&dc<=m&&vis[dr][dc+1]!=1&&vis[dr+1][dc]!=1&&vis[dr-1][dc]!=1&&vis[dr][dc-1]!=1&&vis[dr][dc]!=1){
			vis[r][c]=1;
			DFS(dr,dc,s+1);
			vis[r][c]=0;
		}
	}
}
int main()
{
	scanf("%d %d %d",&n,&m,&k); 
	DFS(1,1,0);
	printf("%lld",cnt);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1188kb

input:

2 2 1

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 1188kb

input:

2 3 2

output:

7

result:

wrong answer 1st numbers differ - expected: '8', found: '7'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1192kb

input:

4 4 2

output:

158

result:

wrong answer 1st numbers differ - expected: '96', found: '158'

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

4 4 5

output:

130

result:

wrong answer 1st numbers differ - expected: '304', found: '130'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1192kb

input:

3 4 3

output:

50

result:

wrong answer 1st numbers differ - expected: '84', found: '50'

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

3 5 2

output:

123

result:

wrong answer 1st numbers differ - expected: '83', found: '123'

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

3 5 3

output:

119

result:

wrong answer 1st numbers differ - expected: '215', found: '119'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

3 5 4

output:

112

result:

wrong answer 1st numbers differ - expected: '276', found: '112'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

3 5 5

output:

99

result:

wrong answer 1st numbers differ - expected: '174', found: '99'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

4 3 5

output:

31

result:

wrong answer 1st numbers differ - expected: '18', found: '31'