UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211967#3815. 种树sesame101ms1252kbC++11599b2024-10-13 09:17:242024-10-13 12:53:42

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,k,ans=0,f=0,mp[20][20];
bool check(int x,int y){
	if(mp[x-1][y]||mp[x][y-1])return false;
	return true;
}
void work(int x,int y,int k1){
//	cout<<x<<' '<<y<<' '<<k1<<endl;
	if(k1==0){
		ans++;
		return;
	}
	if((f&&x==0&&y==0)||x>=n&&y>=m)return;
	f=1;
	if(check(x,y)){
		mp[x][y]++;
		work((x+(y+1)/m)%n,(y+1)%m,k1-1);
		mp[x][y]--;
	}
	work((x+(y+1)/m)%n,(y+1)%m,k1);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m>>k;
	work(0,0,k);
	cout<<ans+1;
	return 0;
}

详细

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

Test #1:

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

input:

2 2 1

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

2 3 2

output:

4

result:

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

Test #3:

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

input:

4 4 2

output:

61

result:

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

Test #4:

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

input:

4 4 5

output:

62

result:

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

Test #5:

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

input:

3 4 3

output:

27

result:

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

Test #6:

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

input:

3 5 2

output:

52

result:

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

Test #7:

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

input:

3 5 3

output:

98

result:

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

Test #8:

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

input:

3 5 4

output:

90

result:

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

Test #9:

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

input:

3 5 5

output:

40

result:

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

Test #10:

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

input:

4 3 5

output:

7

result:

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