原题题目
代码实现(首刷大部分看解小部分自解)
char * stoneGameIII(int* stoneValue, int stoneValueSize){
int dp[50004] = {
0},i,j,sum = 0;for(i=stoneValueSize-1;i>=0;i--){
dp[i] = INT_MIN;sum += stoneValue[i];for(j=1;j<=3;j++)dp[i] = fmax(sum - dp[i+j],dp[i]); }if(dp[0] + dp[0] == sum) return "Tie";else if(dp[0] + dp[0] < sum) return "Bob";else return "Alice";
}