Codeforces #664 Div2 C - Boboniu and Bit Operations 枚举 位运算
题目链接:C - Boboniu and Bit Operations题目大意:给你两个数组 a 和 b,对每一个 ai 任选一个 bj,令 ci = ai & bj,使得最后 c1 | c2 | … | cn 最小。由于题目数据范围很小,所以可以直接暴力枚举。很容易得到答案的范围是 [0, 29-1],令 ans = c1 | c2 | … | cn,那么 ans | ci == ans (1≤i≤n) 是显然成立的,故枚举答案即可。附上代码:#include <bits/stdc
原创
2020-08-14 13:27:01 ·
173 阅读 ·
0 评论