本文共 624 字,大约阅读时间需要 2 分钟。
bool judge(int* piles,int front,int back,int role,int alexsstone,int lisstone){ if(front != back) { if(!role) return judge(piles,front+1,back,1,alexsstone+piles[front],lisstone) || judge(piles,front,back-1,1,alexsstone,lisstone+piles[back]); else return judge(piles,front+1,back,0,alexsstone,lisstone+piles[front]) || judge(piles,front,back-1,0,alexsstone+piles[back],lisstone); } else if(lisstone > alexsstone) return true; else return false;}bool stoneGame(int* piles, int pilesSize){ return judge(piles,0,pilesSize-1,0,0,0);}
转载地址:http://yzqvf.baihongyu.com/