摘要:
map映射一下就好了 class Solution { public: // const int maxn = 30010; int vis[30010]; map<int, int> M; int singleNumber(vector<int>& nums) { int n = nums.siz 阅读全文
摘要:
抽象为把序列分成D段,求和最大的段的最小值 下界为最大值,上界为序列和,二分结果,每次去验证是否合适即可 class Solution { public: int shipWithinDays(vector<int>& weights, int D) { int total = 0; int max 阅读全文
摘要:
就一个dp,别想歪了 dp[i]表示组成数字i的种数 但这题是真坑。。结果保证int内,不代表中间数字在int内 class Solution { public: long long dp[10010]; int combinationSum4(vector<int>& nums, int targ 阅读全文