上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 37 下一页
摘要: 三分查找,用来比较不同坐标处值的大小关系(比较的这两点通常是分布在极值点两侧的),来确定区间内的极值。 三分应用于最优化问题的求解。在解题时没必要给出证明,只要知道问题不满足单调性,就可以尝试用三分搜索极值点,而且三分整数很少见,因为除非能够证明这种策略是正确的(即完全符合凸函数的性质,但是通常极值 阅读全文
posted @ 2020-02-16 19:14 _Ackerman 阅读(256) 评论(0) 推荐(0) 编辑
摘要: C. Yet Another Walking Robot 每次把走到的点记录下来,如果后续出现了一个点在之前已经出现过了,那么肯定出现了重复走。另外维护下 r-l 要尽可能小 #include <iostream> #include <algorithm> #include <string> #in 阅读全文
posted @ 2020-02-16 17:46 _Ackerman 阅读(215) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-16 17:01 _Ackerman 阅读(5) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-15 01:15 _Ackerman 阅读(12) 评论(0) 推荐(0) 编辑
摘要: A. Even But Not Even 仔细分析一下题意,可以发现只和奇数的个数有关: 然后分情况讨论: 1、奇数的个数是奇数 2、奇数的个数是偶数 3、奇数的个数为0 #include <iostream> #include <algorithm> #include <string> #incl 阅读全文
posted @ 2020-02-14 21:51 _Ackerman 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 头文件:#include <bitset> bitset类型在定义时就需要指定所占的空间,例如 bitset<233>bit; bitset类型可以用string和整数初始化(整数转化成对应的二进制) int main() { bitset<23>bit (string("11101001")); 阅读全文
posted @ 2020-02-10 19:47 _Ackerman 阅读(362) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-10 04:39 _Ackerman 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 这里直接以luogu上的一道了例题为例:https://www.luogu.com.cn/problem/P1438 题目描述 维护一个数列{a[i]},支持两种操作: 1、1 L R K D:给出一个长度等于R-L+1的等差数列,首项为K,公差为D,并将它对应加到a[L]~a[R]的每一个数上。即 阅读全文
posted @ 2020-02-09 12:14 _Ackerman 阅读(1382) 评论(0) 推荐(0) 编辑
摘要: 求因子数: LL Getn(LL x){ LL ret = 1; for(LL i = 2; i * i <= x; i++){ if(x % i == 0){ LL a = 0; while(x % i == 0){ x /= i; a++; } ret = ret * (a + 1); } } 阅读全文
posted @ 2020-02-07 20:44 _Ackerman 阅读(590) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-07 20:16 _Ackerman 阅读(10) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 37 下一页