fork download
  1. #include <iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. int a[1000001];
  6. memset(a, 1, sizeof(a));
  7.  
  8. int main() {
  9.  
  10. memset(a, 1, sizeof(a));
  11. a[0] = 0;
  12. //a[1] = a[2] = 1;
  13. int i, j, k;
  14. for(i = 3; i<=1000000; i+=2) {
  15. for(j=i; j<=1000000; j<<=1) {
  16. a[j] = i;
  17. }
  18. }
  19.  
  20. for(i=1; i<=1000000; i++) {
  21. a[i] = (a[i]^a[i-1]);
  22. }
  23.  
  24. int q, l, r;
  25. cin >> q;
  26.  
  27. for(i=0; i<q; i++) {
  28. cin >> l >> r;
  29. cout << (a[l-1]^a[r]) << endl;
  30. }
  31.  
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
3 5
compilation info
prog.cpp:6:7: error: expected constructor, destructor, or type conversion before ‘(’ token
 memset(a, 1, sizeof(a));
       ^
stdout
Standard output is empty