码迷,mamicode.com
首页 >  
搜索关键字:hduoj sum    ( 21465个结果
Vue 项目推荐,Github 过万 Star
电鸭社区-远程工作-自由职业-兼职外包-自由从这开始 嗨,我是 Martin,也叫老王。不少小伙伴,说自己是转行、自学,没有项目,今天推荐一个 Vue 实战项目 还记得 Martin 仿写过在线 Markdown 简历项目吗? 感谢大家的支持,现在有了 64 个 star https://githu ...
分类:其他好文   时间:2020-07-07 09:17:17    阅读次数:87
leetcode-----40. 组合总和 II
链接:https://leetcode-cn.com/problems/combination-sum-ii/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int> ...
分类:其他好文   时间:2020-07-06 16:42:37    阅读次数:50
leetcode-----39. 组合总和
链接:https://leetcode-cn.com/problems/combination-sum/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> c ...
分类:其他好文   时间:2020-07-06 16:29:07    阅读次数:61
CF321E Ciel and Gondolas Wqs二分 四边形不等式优化dp 决策单调性
LINK:CF321E Ciel and Gondolas 很少遇到这么有意思的题目了。虽然很套路。。 容易想到dp $f_{i,j}$表示前i段分了j段的最小值 转移需要维护一个$cost(i,j)$ 暴力显然不太行 不过暴力枚举决策的话 可以预处理前缀和线性推出。 显然想要优化决策的话第一步就需 ...
分类:其他好文   时间:2020-07-06 16:17:17    阅读次数:57
leetcode-473 火柴拼正方形
class Solution { public: bool makesquare(vector<int>& nums) { int l=nums.size(); int sum=0; for(int i=0;i<l;i++) { sum+=nums[i]; } if(sum==0 || (sum/4 ...
分类:其他好文   时间:2020-07-06 16:11:42    阅读次数:36
莫比乌斯反演(HDU5663)
题意: 思路: 代码: 1 const int maxn = 10000000 + 10; 2 ll n, m, a; 3 ll miu[maxn], v[maxn]; 4 ll sum[maxn]; 5 void Eratosthenes(int n) { 6 for (int i = 1; i ...
分类:其他好文   时间:2020-07-06 15:54:27    阅读次数:40
LGTB 与序列
LGTB 与序列(数论 $\star\star $) \(LGTB\) 有一个长度为 \(N\) 的序列 \(A\),现在他想构造一个新的长度为 \(N\) 的序列 \(B\),使得 \(B\) 中的任意两个数都互质。并且他要使 \[ \sum_{1\le i\le N}|A_i-B_i| \] 最 ...
分类:其他好文   时间:2020-07-06 12:39:29    阅读次数:89
Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics)
Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) 题目 难度 思路 A 简单 贪心 B 一般 思维+数学 C 简单 贪心 D 较难 数学+二进制+二分 A. Even Subset Sum Pro ...
分类:其他好文   时间:2020-07-06 00:49:45    阅读次数:56
背包dp(多重)
http://acm.hdu.edu.cn/showproblem.php?pid=1059 多重背包题; 如果sum奇数直接continue;不是奇数则判断dp[sum/2]能不能到达; 即dp[sum/2]的方案数是否为0; 注意输出格式!!! 1 #include<bits/stdc++.h> ...
分类:其他好文   时间:2020-07-05 22:54:20    阅读次数:81
数学公式
数学公式 一.【累加求和】 1+2+3+...+n 普通的方法就是For循环,循环次数为N,时间复杂度为O(N) 累加求和公式 sum = n(n+1)/2时间复杂度为O(1) ...
分类:其他好文   时间:2020-07-05 22:47:42    阅读次数:72
21465条   上一页 1 ... 69 70 71 72 73 ... 2147 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!