首页 > 代码库 > HDU-4994

HDU-4994

/********************************************************************@file     Main_practise.cpp@date     2014-9-17@author   Tiger@brief    Revenge of Nim@details  博弈          谁拿到第一个大于1的堆谁获胜********************************************************************/#include <cstdio>int main(int argc, const char* argv[]){    int nTestCases = 0;    scanf("%d", &nTestCases);    while (nTestCases--)    {        int nNumbers = 0;        scanf("%d", &nNumbers);        int* pArr = new int[nNumbers];        for (int i=0; i<nNumbers; ++i)        {            scanf("%d", &pArr[i]);        }        int nCnt = 0;        for (int i=0; i<nNumbers-1; ++i)        {            if (1 == pArr[i])            {                ++nCnt;            }            else            {                break;            }        }        delete [] pArr;                (nCnt & 1) == 1 ? printf("No\n") : printf("Yes\n");    }        return 0;}

 

HDU-4994