为什么a数组一直是0
查看原帖
为什么a数组一直是0
922781
Dpf20120621楼主2024/5/10 20:18
#include<bits/stdc++.h>
using namespace std;
long long a[33][33];
bool b[33][33];
int main(){
	int n,m,x,y;
	a[1][1]=1;
	a[2][2]=1;
	scanf("%d%d%d%d",&n,&m,&x,&y);
	x++;
	y++;
	b[x][y]=1;
	b[x-2][y-1]=1;
	b[x-2][y+1]=1;
	b[x+2][y-1]=1;
	b[x+2][y+1]=1;
	b[x-1][y+2]=1;
	b[x-1][y-2]=1;
	b[x+1][y+2]=1;
	b[x+1][y-2]=1;
	for(int i=1;i<=n+1;i++){
		for(int j=1;j<=m+1;j++){
			if(!b[i][j])a[i][j]=a[i-1][j]+a[i][j-1];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			printf("%lld ",a[i][j]);
		}
		printf("\n");
	}
	printf("%lld",a[n+1][m+1]);
	return 0;
} 

我无论怎么调用a

都不能修改他的值

2024/5/10 20:18
加载中...