上一页 1 2 3 4 5 6 7 ··· 21 下一页
摘要: 传送门 题目:给定一颗无边权的树,你需要对每条边添加任意大于0的数值。对于树上的任意一条链,对链上的所有边进行(xor)操作后数值为0。你最多和最少可以添加不同的边权。 思路: ①最少:我们可以发现,如果任意两个叶子结点间的边为偶数,则我们只需要用"1"就行。如果出现了偶数,则我们只需要用"1"," 阅读全文
posted @ 2020-08-21 20:00 SummerMingQAQ 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 传送门 题目: Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: You are given two integers d,m fin 阅读全文
posted @ 2020-08-16 22:03 SummerMingQAQ 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 传送门 题目:给定一个数n,问(0~n)相邻两个数之间二进制位不同个数的总和。 思路:看出规律,把n转化为二进制,如果该二进制位处于第x位且为1,则它的贡献为2^(x) - 1,累加所有贡献即可。 1 #include<iostream> 2 #include<string> 3 #include< 阅读全文
posted @ 2020-08-16 15:20 SummerMingQAQ 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 传送门 题目:给定n个长度为m的"0""1"串,你可以改变任意一个位置的二进制,使得边长为偶数的任意一个子矩阵中"1"的个数为奇数,如果不可能输出"-1",可能的话,最少需要改变几个位置的二进制。 思路:硬想太难想。。。(对我来说),然后自己构造了下边长为2,4,6的矩阵,推出一个性质,边长为4的子 阅读全文
posted @ 2020-08-16 00:10 SummerMingQAQ 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 传送门 题目:给定长度为n的数组a,A和B轮流拿走一个数,开始时A和B拥有的v为0,A和B每次拿走一个数时,他的v = v^ ai,A和B都很聪明,问都按照最优的情况考虑,拿完所有数之后A和B的v的大小。 思路:我们可以想到二进制的高低位性质,所以一个人如果有一个最高位二进制为1而另外一个人是0,则 阅读全文
posted @ 2020-08-14 18:35 SummerMingQAQ 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 传送门 思路:如果给定的字符串中,存在一个下标出现了不同的字符,说明这个地方一定只能存在两种字符,如果某个字符在当前位置被改变,则该字符串之后的字符都要相同,然后我们就可以按照这个想法组成一个字符串,然后让这个字符串去和所有字符串比较,相同位置最多出现一个不同的字符("字符串长度为1"和"所有字符串 阅读全文
posted @ 2020-08-13 21:23 SummerMingQAQ 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 加法 1 #include<iostream> 2 #include<string> 3 #include<vector> 4 #include<cstdio> 5 6 using namespace std; 7 vector<int> A, B; 8 9 vector<int> add(vect 阅读全文
posted @ 2020-08-08 20:45 SummerMingQAQ 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 6 using namespace std; 7 8 #define ll long long 9 10 // 题目:给定三种 阅读全文
posted @ 2020-08-07 23:07 SummerMingQAQ 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 #include<set> 6 #include <map> 7 #include <string> 8 using name 阅读全文
posted @ 2020-08-06 12:14 SummerMingQAQ 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 传送门 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 #include<set> 6 #include <map> 7 #include <string> 8 using 阅读全文
posted @ 2020-08-04 21:33 SummerMingQAQ 阅读(174) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 21 下一页