UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211959#3815. 种树chenchen1012ms1188kbC++11597b2024-10-13 09:09:572024-10-13 12:53:24

answer

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;

const int N = 17;

int n, m, k;
int a[N][N];
bool st[N][N];
LL ans;

void dfs(int u)
{
	if (u == k + 1)
	{
		ans ++ ;
		return ;
	}
	for (int i = 1; i <= n; i ++ )
	{
		for (int j = 1; j <= m; j ++ )
		{
			if (st[i - 1][j] == 0 && st[i][j - 1] == 0 && st[i + 1][j] == 0 && st[i][j + 1] == 0)
			{
				st[i][j] = 1;
				dfs(u + 1);
				st[i][j] = 0;
			}
		}
	}
}

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	dfs(1);
	printf("%d\n", ans);
	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: 0ms
memory: 1184kb

input:

2 3 2

output:

29

result:

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

Test #3:

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

input:

4 4 2

output:

232

result:

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

Test #4:

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

input:

4 4 5

output:

921334

result:

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

Test #5:

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

input:

3 4 3

output:

1485

result:

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

Test #6:

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

input:

3 5 2

output:

203

result:

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

Test #7:

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

input:

3 5 3

output:

2995

result:

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

Test #8:

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

input:

3 5 4

output:

44499

result:

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

Test #9:

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

input:

3 5 5

output:

661475

result:

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

Test #10:

score: 0
Wrong Answer
time: 2ms
memory: 1184kb

input:

4 3 5

output:

207627

result:

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