#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <cstdlib> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> using namespace std; /* * Complete the function below. */ int maxXor(int l, int r) { int max = l^l; for(int i = l;i <= r;i++) for(int j = i;j <= r;j++) { if((i^j) > max) max = i^j; } return max; } int main() { int res; int _l; cin >> _l; int _r; cin >> _r; res = maxXor(_l, _r); cout << res; return 0; }
原文地址:http://9320314.blog.51cto.com/9310314/1558582