https://blog.csdn.net/xinqrs01/article/details/55095134
https://www.cnblogs.com/grandyang/p/4800552.html
当前的数一定可以通过之前的数加上数的平方获得
class Solution { public: int numSquares(int n) { vector<int> dp(n+1,INT_MAX); dp[0] = 0; for(int i = 1;i <= n;i++){ for(int j = 1;j*j <= i;j++){ dp[i] = min(dp[i - j*j] + 1,dp[i]); } } return dp[n]; } };