上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 28 下一页
摘要: n堆石子,每次可以选择一堆拿走任意颗石子,不能操作的输,问先手还是后手输。 结论:a1^a2^...^an==0则输,否则赢。 参考证明:https://blog.csdn.net/m0_51755720/article/details/120978376 例题:https://www.codech 阅读全文
posted @ 2022-08-11 09:45 80k 阅读(41) 评论(0) 推荐(0)
摘要: 注意,异或(^)和与(&&)、或(||)、位与(&)、位或(|)的优先级类似 都比加减乘除要低。 注意在运算时要加括号 阅读全文
posted @ 2022-08-10 23:11 80k 阅读(568) 评论(0) 推荐(0)
摘要: 两个数的LCM的常规求法为,两数之积/GCD, 对于多个数也可以分别以此方法求出。 但是对于数据量较大的数,LCM会超过数据范围, 此时可以采用,记录质因子的数量的方法。 用一个数组,记录全部质因子的最大数量。 然后遍历每个数,求出其全部质因子的数量,并更细全局的质因子最大数量。 最后将全部的质因子 阅读全文
posted @ 2022-08-10 12:10 80k 阅读(437) 评论(0) 推荐(0)
摘要: 可以发现,对于部分题目数据量较大,需要用long long存储,可以使用long long。 但是对于题目数据量极大,每一步都要取模的情况下,尽量使用int, 因为对于mod运算,long long比int慢很多(1-2倍),对于时间卡的严格的题目会超时。 例题: https://codeforce 阅读全文
posted @ 2022-08-09 23:20 80k 阅读(377) 评论(0) 推荐(0)
摘要: 开放地址法 M一般是N的十倍左右 find用于查找,看返回值是否为INF find用于插入,直接将待插入的值放到find返回的位置 会比unordered_set快5-10倍。 阅读全文
posted @ 2022-08-08 12:37 80k 阅读(33) 评论(0) 推荐(0)
摘要: https://ac.nowcoder.com/acm/contest/38105/D #include<bits/stdc++.h> typedef unsigned long long LL; using namespace std; LL digit = 1e13; LL nums[20001 阅读全文
posted @ 2022-08-05 11:02 80k 阅读(19) 评论(0) 推荐(0)
摘要: 对a/b做上取整 1、转为浮点数(可能会有精度问题) int a=1; int b = 1; int res = int(ceil(double(a) / b)); View Code 2、通过判断能否整除(比较直观) int a=1; int b = 1; int res = a % b ? a 阅读全文
posted @ 2022-08-04 10:55 80k 阅读(85) 评论(0) 推荐(0)
摘要: 若集合中的任意数在三进制下只含有0和1,则有: 对任意集合中三点x、y、z,有y≠(x+z)/2,即2*y≠x+z,即集合中不存在任意两点x、z的平均值。 (因为2*y全部位均为0或2,而x+z至少存在一位为1) https://atcoder.jp/contests/arc145/editoria 阅读全文
posted @ 2022-08-02 20:54 80k 阅读(33) 评论(0) 推荐(0)
摘要: 对于长度为2N的括号序列,合法的数量为C(2N,N)/(N+1) 参考:https://blog.csdn.net/ffmpeg4976/article/details/42340379?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relev 阅读全文
posted @ 2022-08-02 20:14 80k 阅读(28) 评论(0) 推荐(0)
摘要: #include<iostream> #include<string> #include<vector> #include<fstream> #include"output.h" #include"Delaunay.h" #include"c2dtriangle.h" #include<iomani 阅读全文
posted @ 2022-08-01 11:02 80k 阅读(214) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 28 下一页