摘要: 这里涉及字典序的比较大小方式。string类型不是不能比大小,而是规则上有所不同 粗略地概括一下: 从最高位比起,ASCII码更大的字符串更大。如果相等,比次高位,以此向下类推。 所以在stringstring中,串 9 > 899>89 。因为最高位9 >89>8 阅读全文
posted @ 2020-09-15 15:57 ATKevin 阅读(1976) 评论(0) 推荐(0)
摘要: 左边界模板 找第一个大于等于x的数 while(l < r) { mid = l+r >> 1; if(a[mid].s >= k) r = mid; else l = mid + 1; } if(a[l].s == k) cout << a[l].num << " "; else { cout < 阅读全文
posted @ 2020-09-02 20:33 ATKevin 阅读(117) 评论(0) 推荐(0)
摘要: 基础算法 *排序 快排 不稳定(非复杂度) 时间复杂度:nlogn 思想:先排序,在递归。 题目:https://www.acwing.com/problem/content/787/ #include<iostream> using namespace std; const int maxn = 阅读全文
posted @ 2020-08-24 00:06 ATKevin 阅读(103) 评论(0) 推荐(0)
摘要: 注意有两个变量 now是判断x是不是根,并不是父节点 #include<bits/stdc++.h> using namespace std; const int maxn = 100005; struct edge{ int to, next; }e[maxn << 1]; int head[ma 阅读全文
posted @ 2019-11-13 21:53 ATKevin 阅读(116) 评论(0) 推荐(0)
摘要: 记住了l,r #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; struct edge{ int to, nxt; }e[maxn]; int head[maxn], cnt; int n, m, x, y, 阅读全文
posted @ 2019-11-12 22:30 ATKevin 阅读(198) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; const int inf = 0x3f3f3f3f; struct edge{ int to, nxt; }e[maxn << 1]; int head[ma 阅读全文
posted @ 2019-11-12 21:40 ATKevin 阅读(122) 评论(0) 推荐(0)
摘要: 记住体积倒序,因为每组只能取一个 #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<algorithm> #include<string> using namespace std; int d 阅读全文
posted @ 2019-11-11 21:46 ATKevin 阅读(193) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<algorithm> using namespace std; long a, k, p, n; long quc(long a, long 阅读全文
posted @ 2019-11-10 15:10 ATKevin 阅读(96) 评论(0) 推荐(0)
摘要: 迪杰斯特拉+堆优化 #include<bits/stdc++.h> using namespace std; const int MAXN = 100005; const int MAXM = 200005; struct edge{ int to, next; long long w; }e[MA 阅读全文
posted @ 2019-11-10 10:25 ATKevin 阅读(120) 评论(0) 推荐(0)
摘要: 贴一波地址 https://www.acwing.com/problem/content/904/ 总结: 1.别纠结于怎么变换到b串,只需要知道多少步即可 2.注意初始化 3.注意初始化后,不能改变初始化的值 阅读全文
posted @ 2019-11-03 12:39 ATKevin 阅读(163) 评论(0) 推荐(0)