上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
  2020年4月21日
摘要: 树状数组, 1,单点修改,区间查询;例题 code: 主要操作: int lowbit(int x) { return x&(-x); } void build(int x,int k) { for(int i=x; i<=n; i+=lowbit(i)) tree[i]+=k; } int qua 阅读全文
posted @ 2020-04-21 22:42 mmn 阅读(160) 评论(0) 推荐(0) 编辑
  2020年4月20日
摘要: 链接:https://codeforces.com/contest/1339/problem/C 题意:给你一个数组,你可以在第x秒选一些元素让它们都加上 2^(x-1),问至少需要多少秒可以使数组变成非递减的数组。 题解:找所有逆序对差值中最大的,然后找这个数二进制有几位 code: #inclu 阅读全文
posted @ 2020-04-20 21:36 mmn 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 链接:https://codeforces.com/contest/1339/problem/B 题意:给定一个数组,重排后,按绝对值递增; 排序后,从后往前一大一小输出即可; code: #include<bits/stdc++.h> using namespace std; typedef lo 阅读全文
posted @ 2020-04-20 19:32 mmn 阅读(94) 评论(0) 推荐(0) 编辑
  2020年4月18日
摘要: 题意:十进制下,每相邻两个数字之间的差值不超过1,叫lunlun数, 给定一个k,让找第k小的lunlun数; 暴力打表找规律; 1,2,3,4,5,6,7,8,9, 10,11,12, 21,22,23, 32,33,34, 43,44,45, 54,55,56, 65,66,67, 76,77, 阅读全文
posted @ 2020-04-18 18:06 mmn 阅读(438) 评论(0) 推荐(0) 编辑
摘要: 找某个区间内的最大最小值; 思想:动态规划 用f【i】【j】表示以第i个数为起点,往后连续2^j个数中的最大值; log数组向下取整; code: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int 阅读全文
posted @ 2020-04-18 17:42 mmn 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 唯一分解(算数基本定理);任何一个大于1的自然数N,如果N不为质数,那么N可以唯一分解成有限个质数的乘积P1^a1*P2^a2*...Pn^an,这里P1<P2<P3......<Pn均为质数,其中指数ai是正整数。这样的分解称为 N 的标准分解式。最早证明是由欧几里得给出的。(扩展:交换代数) 例 阅读全文
posted @ 2020-04-18 00:06 mmn 阅读(901) 评论(0) 推荐(0) 编辑
  2020年4月17日
摘要: #include<iostream> #include<cstdio> #include<queue> #include<cstring> #include<algorithm> typedef long long LL; using namespace std; LL RD(){ LL out = 阅读全文
posted @ 2020-04-17 22:57 mmn 阅读(146) 评论(0) 推荐(0) 编辑
摘要: dfs序就是一棵树在dfs遍历时组成的节点序列.(先序遍历差不多),dfs序把一棵树进行区间化 出入的区间就是它掌控的子树,出入分别即为in[x],out[x],in[x]为结点x进入时的时间戳,out[x]为结点x出去时的时间戳 比如上图子树,dfs序为,A B E E F K K F B C G 阅读全文
posted @ 2020-04-17 22:56 mmn 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 链接:https://codeforces.com/contest/765/problem/D 题意;给n个数,分别是f(i),让你找n个g(i)和m(任意)个h(i), 其中,g(h(x))=x,h(g(x))=f(x); 题解:推一下这个式子,可得到h(x)=f(h(x)),g(x)=g(f(x 阅读全文
posted @ 2020-04-17 21:48 mmn 阅读(92) 评论(0) 推荐(0) 编辑
  2020年4月16日
摘要: 链接: 题意:给一个01串,可以交换相邻两个的位置k次问字典序最小的序列; 简单的贪心题,每次考虑把最小的往前放,最小只有零,找一下交换的代价即可; code; #include<bits/stdc++.h> using namespace std; const int maxn=10010; vo 阅读全文
posted @ 2020-04-16 00:53 mmn 阅读(83) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页