什么鬼啊!!!
发了两次都没人……
by mushroom_knight @ 2020-06-26 20:05:32
开个```__int128```试试?
by s_r_f @ 2020-06-26 20:07:32
@[s_r_f](/user/52518) ?好的,还有,第二个测试点是控制点在终点,已经改了
by mushroom_knight @ 2020-06-26 20:10:06
@[s_r_f](/user/52518) 也不行
by mushroom_knight @ 2020-06-26 20:10:54
现在:
```
#include<bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int dx[8]={2,2,-2,-2,-1,-1,1,1};
int dy[8]={1,-1,1,-1,2,-2,2,-2};
unsigned long long f[52][52];
bool vis[52][52];
void init(int x,int y){
for(register int i=0;i<8;++i){
int nx,ny;
nx=x+dx[i];
ny=y+dy[i];
if(nx&&ny){
vis[nx][ny]=true;
}
}
vis[x][y]=true;
}
void dp_(int n,int m){
for(register int i=0;i<=n;++i){
for(register int j=0;j<=m;++j){
if(vis[i][j]!=true){
f[i+1][j]+=f[i][j];
f[i][j+1]+=f[i][j];
}
}
}
}
int n,m;
int ui,uj;
int main(){
scanf("%d%d%d%d",&n,&m,&ui,&uj);
init(ui,uj);
f[0][0]=1;
dp_(n,m);
if(!vis[n][m]){
cout<<f[n][m];
}
else{
cout<<"0";
}
return 0;
}
```
by mushroom_knight @ 2020-06-26 20:11:19
哇哇哇,我又只能输出测试数据骗分了吗!
by mushroom_knight @ 2020-06-26 20:15:44
哦,第二个是把卒给卡死了出不去
我改成pull型好了
by mushroom_knight @ 2020-06-26 20:24:31
```cpp
#include <iostream>
#include <map>
#include <cstring>
using namespace std;
const int MAX_N = 21;
#define ALEN(x) static_cast<int>((sizeof(x)/sizeof(x[0])))
long long chess[MAX_N][MAX_N];
pair<int, int> b, horse;
int horse_control_x[] = {-2, -2, -1, -1, 1, 1, 2, 2};
int horse_control_y[] = { 1, -1, 2, -2, 2, -2, 1, -1};
int main() {
cin >> b.first >> b.second
>> horse.first >> horse.second;
// init
for(int x = 0; x <= b.first; ++x) {
for(int y = 0; y <= b.second; ++y) {
chess[x][y] = -1;
}
}
// set horse control
for(int i = 0; i < ALEN(horse_control_x); ++i) {
int x = horse.first + horse_control_x[i];
int y = horse.second + horse_control_y[i];
if(x >= 0 && x <= b.first && y >= 0 && y <= b.second) {
chess[x][y] = 0;
if(x == 0) {
for(int j = y + 1; j <= b.second; ++j) {
chess[x][j] = 0;
}
}
if(y == 0) {
for(int j = x + 1; j <= b.first; ++j) {
chess[j][y] = 0;
}
}
}
}
chess[horse.first][horse.second] = 0;
if(horse.first == 0) {
for(int j = horse.second + 1; j <= b.second; ++j) {
chess[horse.first][j] = 0;
}
}
if(horse.second == 0) {
for(int j = horse.first + 1; j <= b.first; ++j) {
chess[j][horse.second] = 0;
}
}
// calculate path
for(int x = 0; x <= b.first; ++x) {
for(int y = 0; y <= b.second; ++y) {
if(x == 0 && chess[x][y] != 0) {
chess[x][y] = 1;
}
else if(y == 0 && chess[x][y] != 0) {
chess[x][y] = 1;
}
else if(x != 0 && y != 0 && chess[x][y] != 0) {
chess[x][y] = chess[x - 1][y] + chess[x][y - 1];
}
}
}
cout << chess[b.first][b.second] << endl;
return 0;
}
```
by Hally10 @ 2020-07-01 15:38:53