听说位运算挺好玩的,那这节总结一下ACM中可能用到的位运算技巧。(可能更新) XOR运算极为重要!!(过[LC136](只出现一次的数字 - 力扣(LeetCode)):数组中每个数字都出现两次,只有一个出现一次,找到出现一次的数字) 1. 如果我们对 0 和二进制位做 XOR 运算,得到的仍然是这 ...
分类:
其他好文 时间:
2020-04-11 10:14:45
阅读次数:
66
A.CodeForces-124A (简单数学题) #include<cstdio> #include<algorithm> #include<iostream> #include<cmath> using namespace std; int main(){ int a,b,n; scanf("% ...
分类:
其他好文 时间:
2020-04-09 15:32:13
阅读次数:
84
题目描述: 你这个学期必须选修 numCourse 门课程,记为 0 到 numCourse-1 。在选修某些课程之前需要一些先修课程。 例如,想要学习课程 0 ,你需要先完成课程 1 ,我们用一个匹配来表示他们:[0,1]给定课程总量以及它们的先决条件,请你判断是否可能完成所有课程的学习? 最近打 ...
分类:
编程语言 时间:
2020-04-09 15:26:58
阅读次数:
100
``` #include #include #define int long long using namespace std; const int N=4010,mod=1e9+7; int a[N]; int e[N*N],ne[N*N],idx,h[N]; int st[N]; int ans... ...
分类:
其他好文 时间:
2020-04-09 10:53:11
阅读次数:
150
``` #include #include #include #include #include #include using namespace std; #define LL long long const int N=1010; int val[N][N]; int res[N][N]; ch... ...
分类:
其他好文 时间:
2020-04-09 10:34:36
阅读次数:
114
A:https://vjudge.net/contest/366415#problem A是是找规律的题目,找几个数据就可以得出答案。或者自己一步步论证得出,做题的说话是一步步论证得出的。 #include<iostream> #include<cstdio> #include<set> #incl ...
分类:
其他好文 时间:
2020-04-08 21:02:34
阅读次数:
92
题目描述 Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project. Input Specification ...
分类:
其他好文 时间:
2020-04-08 12:23:10
阅读次数:
78
当要查找的元素个数相对比较小的时候,函数 nlargest() 和 nsmallest() 是很合适的。 如果你仅仅想查找唯一的最小或最大(N=1)的元素的话,那么使用 min() 和 max() 函数会更快些。 类似的,如果 N 的大小和集合大小接近的时候,通常先排序这个集合然后再使用切片操作会更 ...
分类:
其他好文 时间:
2020-04-08 12:18:57
阅读次数:
58
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5383 思路 设置超级源点S,超级汇点T S向0集怪兽建边,容量为1,费用为怪兽战斗力; 1集怪兽向T建边,容量为1,费用为怪兽战斗力; 0集怪兽向1集怪兽建边,容量为1,费用为合成怪兽最大战斗力 两个怪 ...
分类:
其他好文 时间:
2020-04-07 09:15:28
阅读次数:
68
集合栈计算机(The Set Stack Computer,ACM/ICPC NWERC 2006,UVa12096) 对于集合的集合,很难直接表示,因此,为方便起见,为每个不同的集合分配一个不同的ID,每个集合都可以表示成所含集合的ID集合,一个集合就可以表示为一个set 实际进行操作的过程中,可 ...
分类:
其他好文 时间:
2020-04-06 21:06:22
阅读次数:
116