fork download
  1. #include <iostream>
  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. if((i ^ 1) == x) poss++;
  12. }
  13. }
  14. cout << poss;
  15. return 0;
  16. }
Success #stdin #stdout 1.2s 5432KB
stdin
12345 56789 34567
stdout
33900