随笔分类 -  基础算法刷题记录

摘要:基本思想: 使用迭代会很麻烦,还不如递归进行字符串拼接; 关键点: 无; #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; const int maxn = 15 阅读全文
posted @ 2020-03-14 17:58 暮云林凌 阅读(168) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<vector> #include<string> using namespace std; bool vis[26]; void charge(string s,int cnt) { if (cnt == 0) 阅读全文
posted @ 2020-03-14 02:10 暮云林凌 阅读(151) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<vector> using namespace std; int main() { int n; while (cin >> n) { vector<int>vec; vec.push_back(1); vec 阅读全文
posted @ 2020-03-14 01:50 暮云林凌 阅读(207) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<algorithm> #include<string> #include<stdio.h> #include<vector> using namespace std; bool flag; struct nod 阅读全文
posted @ 2020-03-14 01:29 暮云林凌 阅读(130) 评论(0) 推荐(0)
摘要:基本思想: 自己想复杂了,把要给人选多门课给包含进去了; 关键点: 无; #include<iostream> #include<algorithm> #include<string> #include<vector> using namespace std; const int maxn = 21 阅读全文
posted @ 2020-03-14 01:20 暮云林凌 阅读(182) 评论(0) 推荐(0)
摘要:基本思想: 其实用二叉树更简单一点,但是个人认为题目有可能不太严谨,会出现多棵树情况,用二叉树一样的还是要判断节点是否在一棵树上,没啥必要; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<algorithm 阅读全文
posted @ 2020-03-14 00:53 暮云林凌 阅读(129) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<algorithm> #include<set> using namespace std; const int maxn = 1000000; 阅读全文
posted @ 2020-03-14 00:03 暮云林凌 阅读(136) 评论(0) 推荐(0)
摘要:关键点: 无; 基本思想: 无; #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int ht[101]; int main() { int n; int a; 阅读全文
posted @ 2020-03-13 23:51 暮云林凌 阅读(144) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<queue> using namespace std; const int maxn = 1000000; int num[maxn]; in 阅读全文
posted @ 2020-03-13 23:47 暮云林凌 阅读(236) 评论(0) 推荐(0)
摘要:基本思想: 优先队列保证数值最小; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<queue> using namespace std; int main() { int n; int a; while ( 阅读全文
posted @ 2020-03-12 20:08 暮云林凌 阅读(191) 评论(0) 推荐(0)
摘要:基本思想: 优先队列问题,但是也可以直接sort cmp解决,感觉有点累赘,思想受限; 关键点: 无; #include<queue> #include<vector> #include<iostream> #include<string> #include<cmath> #include<algo 阅读全文
posted @ 2020-03-12 19:20 暮云林凌 阅读(167) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<string> #include<vector> using namespace std; void devide(string s, int n, int& r) { for (int i = 0; i < 阅读全文
posted @ 2020-03-12 01:02 暮云林凌 阅读(185) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<string> #include<vector> #include<iostream> #include<algorithm> #include<math.h> using namespace std; void add(string& a, st 阅读全文
posted @ 2020-03-12 00:43 暮云林凌 阅读(173) 评论(0) 推荐(0)
摘要:基本思想: 注意取模公式: 关键点: 无; #include<iostream> #include<vector> using namespace std; const int mod = 10000; int a, b, p, q, k; int num[mod]; void init() { n 阅读全文
posted @ 2020-03-12 00:24 暮云林凌 阅读(302) 评论(0) 推荐(0)
摘要:刚开始用的字符串来做,爆时间了; 采用如上推导,可以变成快速幂取模,这样一切就明了了; 还要注意,有的测试点算出了Nr=0,根据定律,只能得到N=k-1; 关键点: 无; #include<iostream> #include<string> #include<vector> using names 阅读全文
posted @ 2020-03-11 23:54 暮云林凌 阅读(226) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<vector> #include<algorithm> #include<math.h> #include<string> using namespace std; void mutlip(string &s, 阅读全文
posted @ 2020-03-11 23:01 暮云林凌 阅读(216) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<vector> #include<algorithm> #include<math.h> using namespace std; typedef long long ll; void charge(ll n) 阅读全文
posted @ 2020-03-11 12:14 暮云林凌 阅读(166) 评论(0) 推荐(0)
摘要:基本思路: 无; 关键点: 无; #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; vector<int>vec; int mostin(int a, int b 阅读全文
posted @ 2020-03-11 12:03 暮云林凌 阅读(183) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<string> using namespace std; typedef long long ll; ll tranten(string s,int r) { ll cnt = 0; for (int i = 阅读全文
posted @ 2020-03-11 02:01 暮云林凌 阅读(152) 评论(0) 推荐(0)
摘要:基本思想: 无; 关键点: 无; #include<iostream> #include<string> using namespace std; void charge(string s) { int cnt = 0; for (int i = 0; i < s.size(); i++) { if 阅读全文
posted @ 2020-03-11 01:43 暮云林凌 阅读(135) 评论(0) 推荐(0)