求a|(a+1)|(a+2)|...|(b-1)|b。
求a-b的差的每一个二进制位
自己也看不懂。。。
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { LL a,b; while(cin >> a >> b) { LL res = a; LL x = 1; while (a + x <= b) { res |= (x + a); x <<= 1; } cout << (res|b) << endl; } return 0; }
原文:https://www.cnblogs.com/YDDDD/p/10352881.html