Think:
1知识点:【进制转换+异或运算】
2题意:输入一个序列a[1..n],判断满足一下两个条件的S有多少个
(1):0 <= S < pow(2, 60)
(2):对于i(1 <= i < n),(a[i] xor S) <= (a[i+1] xor S)
3解题思路:
(1):先将a[i]和a[i+1]转换为二进制,然后通过异或运算相同为零不同为一的性质和(a[i] xor S) <= (a[i+1] xor S)的条件确定可以确定的位,然后对于无法确定的位则均有两种取值(0、1),进而得到满足条件的S的个数
以下为Accepted代码
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long