呜呜呜呜呜,原本就是把没做的题看一遍,结果就有一个测评点不对。
#include <bits/stdc++.h>
using namespace std;
const int N=30;
long long g[N][N];
int n,m,x,y;
bool Ctrl(int tx,int ty){
if(tx==x&&ty==y) return true;
else if(tx==x+2&&ty==y+1) return true;
else if(tx==x+1&&ty==y+2) return true;
else if(tx==x-1&&ty==y+2) return true;
else if(tx==x-2&&ty==y+1) return true;
else if(tx==x-2&&ty==y-1) return true;
else if(tx==x-1&&ty==y-2) return true;
else if(tx==x+1&&ty==y-2) return true;
else if(tx==x+2&&ty==y-1) return true;
else return false;
}
void Reset(){
for(int j=0;j<=m;j++){
if(Ctrl(0,j)==0){
g[0][j]=1;
}
else break;
}
for(int i=0;i<=n;i++){
if(Ctrl(i,0)==0){
g[i][0]=1;
}
else break;
}
return ;
}
int main(){
cin>>n>>m>>x>>y;
Reset();
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(Ctrl(i,j)==0){
g[i][j]=g[i-1][j]+g[i][j-1];
}
}
}
cout<<g[n][m];
return 0;
}
在线等 等会:传送门:P1002 NOIP2002 普及组 过河卒