题目大意:给定 N 个操作,每个操作为按位与.或.异或一个固定的数字,现在要求从 0 到 M 中任选一个数字,使得依次经过 N 个操作后的值最大. 题解:位运算有一个重要的性质是:位运算时,无进位产生,每一位之间相互独立.因此,可以从高到低依次考虑每一位对答案的贡献值,计算每一位经过这 N 个操作后的值,比较后更新答案贡献即可. 代码如下 #include <bits/stdc++.h> using namespace std; const int maxn=1e5+10; int n,m;…
Winner Winner 题目链接 题目描述 The FZU Code Carnival is a programming competetion hosted by the ACM-ICPC Training Center of Fuzhou University. The activity mainly includes the programming contest like ACM-ICPC and strive to provide participants with interes…