51nod 1534 棋子游戏(简单博弈)

https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1534

分类枚举情况就行了,分成四个板块。

#include
using namespace std;
struct point{
    int x,y;
};

int main()
{
    point a,b;
    while(cin>>a.x>>a.y>>b.x>>b.y)
    {
        int blag;
        if(a.x<=b.x&&a.y<=b.y)
          blag=1;
        else if(a.x>b.x&&a.y>b.y)
          blag=0;
        else 
        {
            int ans1=max(b.x,b.y);
            int ans2=a.x+a.y;
            if(ans1>=ans2)
              blag=1;
            else
              blag=0; 
        }
        if(blag)
          cout<<"Polycarp"<else
          cout<<"Vasiliy"<return 0;
}

你可能感兴趣的:(ACM)