Skip to content

Latest commit

 

History

History
 
 

1510.Stone-Game-IV

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

1510.Stone-Game-IV

很显然的决策问题。假设dp[n]表示我方手头数字是n时能否胜利。那么遍历自己的决策(减去某个平方数),将剩下的数字(假设是m)转移给对手。一旦对手处理的数字m最终得到的结果是失败,那么说明我方肯定能赢。如果无论什么m,对手都能处理成功,那么说明我方肯定输。

本题的递归和DP写法都很好写。