51nod 1995 三子棋(规律题)

题目链接:点我

发现棋盘是对称的,所有只考虑左小半角或右上半角的情况即可,然后自己手推,oh my god,
然后打一下表,然后就过了。。过了 ,不过注意题目是要稳赢的步数

#include<iostream>
using namespace std;
int qi[4][5];


int main()
{
    int t;
    int x,y;
    qi[1][1]=qi[1][4]=qi[3][1]=qi[3][4]=6;
    qi[1][2]=qi[1][3]=qi[2][2]=qi[2][3]=qi[3][2]=qi[3][3]=4;
    qi[2][1]=qi[2][4]=0;
    cin>>t;
    while(t--)
    {
        cin>>x>>y;
        if(qi[x][y]==0)
        {
            cout<<"Equal"<<endl;
            cout<<0<<endl;
        }
        else if(qi[x][y]==4)
        {
            cout<<"Win"<<endl;
            cout<<4<<endl;
        }
        else if(qi[x][y]==6)
        {
            cout<<"Win"<<endl;
            cout<<6<<endl;
        }
    }
   return 0;

}

猜你喜欢

转载自blog.csdn.net/qq_37774171/article/details/81810502
今日推荐