求,第一个点WA
查看原帖
求,第一个点WA
817704
Inferior_dust楼主2023/11/13 14:04

真的不知道错哪里了, 谢谢 !

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define LL long long

LL read() {
	LL x = 0;
	char c = getchar();
	while(c > '9' || c < '0') c = getchar();
	while(c <='9' && c >= '0') {
		x = x * 10 + (c - '0');
		c = getchar();
	}
	return x;
}

void write(LL x) {
	if(x > 9) write(x / 10);
	putchar(x % 10 + '0');
}

LL x, y;
LL hx, hy;

bool a[30][30];

LL f[30];

LL dx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2};
LL dy[] = {0, 1, 2, 2, 1, -1, -2, -2, -1};

int main()
{
//	memset(f, 0, sizeof(f));
	for(LL i = 0; i <= 25; i ++) {
		for(LL j = 0; j <= 25; j ++) {
			a[i][j] = true;
		}
	}
	f[0] = 1;
	x = read();
	y = read();
	hx = read();
	hy = read();
	for(LL i = 0; i <= 8; i ++) {
		a[hx + dx[i]][hy + dy[i]] = false;
	}
	for(LL i = 0; i <= x; i ++) {
		for(LL j = 0; j <= y; j ++) {
			if(a[i][j]) {
				f[j] = f[j] + f[j - 1]; 
			}
			else f[j] = 0;
		}
	}
	write(f[y]);
	putchar('\n');
	return 0;
}
2023/11/13 14:04
加载中...