上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 32 下一页
摘要: #include <iostream> using namespace std; const int MAXN = 1e4 + 10; int arr[MAXN]; int N, M; void init(int N) //初始化根节点为自己 { for(int i = 1; i <= N; i++ 阅读全文
posted @ 2018-07-27 11:00 张浦 阅读(59) 评论(0) 推荐(0) 编辑
摘要: qpow 快速幂 #include <iostream> using namespace std; typedef long long ll; ll N, M, MOD; ll qpow(ll a, ll b) { ll ans = 1; a %= MOD; //预处理 while(b) { if( 阅读全文
posted @ 2018-07-25 17:54 张浦 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 1.快速排序 #include <iostream> using namespace std; const int MAXN = 2e5 + 10; int arr[MAXN]; int len; void qsort(int arr[], int fst, int lst) { int i = f 阅读全文
posted @ 2018-07-25 16:15 张浦 阅读(151) 评论(0) 推荐(0) 编辑
摘要: “年轻人切忌旋入技术细节漩涡, 那是无底之洞” ----Zeo 基础BFS加一堆字符串处理细节逐个比较是否可替换替换时把字符拆成三段 前 要替换的 后根据string 特性前 + 替换的... 阅读全文
posted @ 2018-07-25 15:41 张浦 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 水题#include #include using namespace std;const int MAXN = 1e5;int arr[MAXN];int ans = 0;int N, M;bool find(... 阅读全文
posted @ 2018-07-24 18:54 张浦 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 网上都是二分搜索答案其实过程也可以二分搜索洛谷有个扔瓶盖一样的#include #include using namespace std;const int MAXN = 1e5 + 50;int cow[MA... 阅读全文
posted @ 2018-07-24 17:42 张浦 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 按左点排序能干就干 干不了加人但这次数据非常大 手动模拟超时需要用到优先队列 或 mutilset队列能解决的set 都可以解决set支持性更佳 所以个人更倾向于set#include #include #inc... 阅读全文
posted @ 2018-07-24 17:01 张浦 阅读(89) 评论(0) 推荐(0) 编辑
摘要: bfs 有稳定向下搜索(距离恒定)的特性常用来求最优解(首解必定最优)用队列维护搜索可保持其顺序特性bfs的过程比dfs容易理解的多在此不做记录该题单bfs可以过七个点三个tle需要优化仔细推一遍可以发现每次求得... 阅读全文
posted @ 2018-07-24 16:47 张浦 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 这个题求连续下降距离第一个想法肯定是DFS接着想一下可能会出现向下深搜的过程中搜到已经搜过的点所以再记忆化以下#include using namespace std;typedef long long ll;c... 阅读全文
posted @ 2018-07-17 18:15 张浦 阅读(78) 评论(0) 推荐(0) 编辑
摘要: C. Three Parts of the Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inpu... 阅读全文
posted @ 2018-07-17 10:55 张浦 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 32 下一页