P5380 [THUPC2019]鸭棋(模拟)

传送门

最近代码能力急剧下降,所以开始刷大模拟
这道题坑点很多,细节都在代码注释里了
code:

#include<bits/stdc++.h>
using namespace std;
inline int read(){
   
    register int s=0,f=1;
    register char ch=getchar();
    while(!isdigit(ch)){
   if(ch=='-')f*=-1;ch=getchar();}
    while(isdigit(ch))s=(s<<1)+(s<<3)+(ch^48),ch=getchar();
    return s*f;
}
const int captain[20][5]={
   
    {
   0,1},{
   1,0},{
   0,-1},{
   -1,0}
};
const int guard[20][5]={
   
    {
   1,1},{
   1,-1},{
   -1,1},{
   -1,-1}
};
const int elephant[20][5]={
   
    {
   2,-2},{
   -2,2},{
   2,2},{
   -2,-2}
};
const int Elephant[20][5]={
   
    {
   1,-1},{
   -1,1},{
   1,1},{
   -1,-1}
};
const int horse[20][5]={
   
    {
   2,-1},{
   2,1},{
   1,2},{
   -1,2},{
   -2,1},{
   -2,-1},{
   -1,-2},{
   1,-2}
};
const int Horse[20][5]={
   
    {
   1,0},{
   1,0},{
   0,1},{
   0,1},{
   -1,0},{
   -1,0},{
   0,-1},{
   0,-1}
};
const int duck[20][5]={
   
    {
   3,2},{
   -3,2},{
   2,3},{
   2,-3},{
   3,-2},{
   -3,-2},{
   -2,3},{
   -2,-3}
};
const int Duck[20][5]={
   
    {
   1,0},{
   -1,0},{
   0,1},{
   0,-1},{
   1,0},{
   -1,0},{
   0,1},{
   0,-1},
    {
   2,1},{
   -2,1},{
   1,2},{
   1,-2},{
   2,-1},{
   -2,-1},{
   -1,2},{
   -1,-2}
};
const int soldier[20][5]={
   
    {
   0,1},{
   1,0},{
   0,-1},{
   -1,0},{
   1,1},{
   -1,-1},{
   1,-1},{
   -1,1}
};
//每个子的走法如上
int color,End,flg;
int a[20][20],h[20][20];
string f[10];
void Clean(){
   
    f[1]="captain";f[2]="guard";
    f[3]="elephant";f[4]="horse";
    f[5]="car";f[6]="duck";f[7]="soldier";//数字对应棋子

    a[1][1]=a[1][9]=5,h[1][1]=h[1][9]=1;
    a[1][2]=a[1][8]=4,h[1][2]=h[1][8]=1;
    a[1][3]=a[1][7]=3,h[1][3]=h[1][7]=1;
    a[1][4]=a[1]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值