- 象棋
1
- @ 2025-11-22 16:10:30
#include <bits/stdc++.h>
using namespace std;
int main() {
int p,x0,y0,x1,y1;
cin>>p>>x0>>y0>>x1>>y1;
if(p==2){
cout<<"No";
}
if(p==3){
if(
(x0+2==x1 && y0+1==y1) ||
(x0+2==x1 && y0-1==y1) ||
(x0-2==x1 && y0+1==y1) ||
(x0-2==x1 && y0-1==y1) ||
(x0+1==x1 && y0+2==y1) ||
(x0+1==x1 && y0-2==y1) ||
(x0-1==x1 && y0+2==y1) ||
(x0-1==x1 && y0-2==y1)
){
cout <<"Yes";
}else{
cout<<"No";
}
}
if(p==4){
if(
(x0+2==x1&&y0+2==y1) ||
(x0+2==x1&&y0-2==y1) ||
(x0-2==x1&&y0+2==y1) ||
(x0-2==x1&&y0-2==y1)
){
cout <<"Yes";
}else{
cout <<"No";
}
}
if(p==1){
if(x0==x1 || y0==y1){
cout<<"Yes";
}else{
cout<<"No";
}
}
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 48
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 48
- 已通过
- 11
- 上传者