fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int l,r,x;
  6. cin >> l >> r >> x;
  7. int poss = 0;
  8. for(int i = l; i <= r; i++){
  9. for(int j = i+1; j <= r; j++){
  10. if((i ^ j) == x) poss++;
  11. }
  12. }
  13. cout << poss;
  14. return 0;
  15. }
Success #stdin #stdout 0.85s 5524KB
stdin
12345 56789 34567
stdout
11677