上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: #include<bits/stdc++.h> using namespace std; struct st{ int num,val; }a[1000005]; deque<st>q; //最小值 deque<st>p; //最大值 int main(){ int n,k; cin>>n>>k; 阅读全文
posted @ 2020-09-18 09:15 _LH2000 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<cstdio> #include<cstring> using namespace std; typedef long long ll; const int maxn=200005; vector<int> t 阅读全文
posted @ 2020-09-14 00:16 _LH2000 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://ac.nowcoder.com/acm/contest/5672/B 题意 比较晦涩,意思大概是,给定 n 和 m 。问你要一个序列。 这个序列尽可能短,同时令其字典序尽可能小。这个序列满足,可以将其划分为n个组使其值之和相等。也能划分为m个。 做法 逐步缩小问题的规模。对 阅读全文
posted @ 2020-08-01 23:04 _LH2000 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<string.h> #include<map> #include<string> #include<algorithm> #include<cstdio> using namespace std; #defin 阅读全文
posted @ 2020-07-25 15:12 _LH2000 阅读(129) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=6763 题目链接 题意 :n 个城市 b条路 每个城市都有灯 每个灯都有亮度 每次从联通的城市里面选择一些亮度一起-1;问要减多少次; 做法: 并查集+sort 先按照亮度排序,把所有点看成孤立的,ans+=当前节 阅读全文
posted @ 2020-07-23 21:42 _LH2000 阅读(304) 评论(0) 推荐(1) 编辑
摘要: substr()函数定义于头文件 <string> 一、参数:(pos, n)pos - 从此位置开始拷贝n - 拷贝 n 长度的字符串 二、形式:s.substr(pos, n) 三、解释:返回一个string,包含s中从pos开始的n个字符的拷贝。 #include<iostream> #inc 阅读全文
posted @ 2020-07-18 21:31 _LH2000 阅读(895) 评论(0) 推荐(0) 编辑
摘要: 首先介绍一下什么是置换群,不说一些繁琐的概念。 首先给你一个序列,假如: s = {1 2 3 4 5 6} 然后给你一个变换规则 t = {6 3 4 2 1 5} 就是每一次按照t规则变换下去 比如这样 第一次:6 3 4 2 1 5 第二次:5 4 2 3 6 1 第三次:1 2 3 4 5 阅读全文
posted @ 2020-07-17 15:41 _LH2000 阅读(658) 评论(0) 推荐(0) 编辑
摘要: ll Pow(ll a, ll b){ ll ans = 1; while(b > 0){ if(b & 1){ ans = ans * a % mod; } a = a * a % mod; b >>= 1; } return ans; } 阅读全文
posted @ 2020-07-14 14:15 _LH2000 阅读(114) 评论(0) 推荐(0) 编辑
摘要: KMP算法中,求了一个前缀函数: 为前 个字符组成的子串中、真前缀、真后缀相等的最大长度。例如对于abcabcd a,,没有真前后缀。 ab, abc, abca, abcab, abcabc, abcabcd, 那么对于给出的字符串求 数组后,前后缀相等的最大长度即为 。并且只要途中出现过 ,就说 阅读全文
posted @ 2020-07-14 12:00 _LH2000 阅读(148) 评论(0) 推荐(0) 编辑
摘要: reverse() std:: void reverse(s.begin(), s.end());上面是原地反转的方法,如果需要反转到别的 string 里面,一样简单: s1.assign(s.rbegin(), s.rend());效率也相当理想。 阅读全文
posted @ 2020-07-13 21:06 _LH2000 阅读(450) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页